[信息与未来 2014] 连续非素数子序列的最大长度

Luogu
IDLGB4130
Time1000ms
Memory512MB
DifficultyP2
2014江苏枚举素数判断,质数,筛法信息与未来
给出一个正整数 $n$,求在数列 $\{2,3,\cdots,n\}$ 中,连续非素数子序列的最大长度。 ## Input 一个整数 $n$。 ## Output 一个整数,表示连续非素数子序列的最大长度。 [samples] ## Note ### 样例 $\textbf1$ 解释 | 连续非素数子序列 | 长度 | | :----------: | :----------: | | $\{4\}$ | $1$ | | $\{6\}$ | $1$ | | $\{8,9,10\}$ | $3$ | | $\{12\}$ | $1$ | 其中,最大长度为 $3$,即有连续的 $3$ 个非素数。 ### 数据范围 $2\le n\le 5\times10^6$。
Samples
Input #1
12
Output #1
3
Input #2
30
Output #2
5
API Response (JSON)
{
  "problem": {
    "name": "[信息与未来 2014] 连续非素数子序列的最大长度",
    "description": {
      "content": "给出一个正整数 $n$,求在数列 $\\{2,3,\\cdots,n\\}$ 中,连续非素数子序列的最大长度。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 524288
    },
    "difficulty": {
      "LuoguStyle": "P2"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGB4130"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "给出一个正整数 $n$,求在数列 $\\{2,3,\\cdots,n\\}$\n中,连续非素数子序列的最大长度。\n\n## Input\n\n一个整数 $n$。\n\n## Output\n\n一个整数,表示连续非素数子序列的最大长度。\n\n[samples]\n\n## Note\n\n### 样例 $\\textbf1$ 解释\n| 连续非素数子序列 | 长度 |\n| :----------: | :----------: |\n...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments