Next Prime

AtCoder
IDabc149_c
Time2000ms
Memory256MB
Difficulty
Find the minimum prime number greater than or equal to $X$. ## Constraints * $2 \le X \le 10^5$ * All values in input are integers. ## Input Input is given from Standard Input in the following format: $X$ [samples] ## Notes A prime number is an integer greater than $1$ that cannot be evenly divided by any positive integer except $1$ and itself. For example, $2$, $3$, and $5$ are prime numbers, while $4$ and $6$ are not.
Samples
Input #1
20
Output #1
23

The minimum prime number greater than or equal to $20$ is $23$.
Input #2
2
Output #2
2

$X$ itself can be a prime number.
Input #3
99992
Output #3
100003
API Response (JSON)
{
  "problem": {
    "name": "Next Prime",
    "description": {
      "content": "Find the minimum prime number greater than or equal to $X$.",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc149_c"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Find the minimum prime number greater than or equal to $X$.\n\n## Constraints\n\n*   $2 \\le X \\le 10^5$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments