Rooted Tree

AtCoder
IDfps_24_o
Time3000ms
Memory256MB
Difficulty
Consider rooted trees with $N$ vertices, where the vertices are labeled $1$ through $N$, and vertex $1$ is the root. Count how many such rooted trees satisfy the following condition, and output the result modulo $998244353$. * For every integer $i$ such that $1 \leq i \leq N$, the number of children of vertex $i$ is either $0$ or a prime number. ## Constraints * $3 \leq N \leq 2.5 \times 10^5$ * $N$ is an integer ## Input The input is given from standard input in the following format: $N$ [samples]
Samples
Input #1
3
Output #1
1

For example, consider the rooted tree where both vertex $2$ and vertex $3$ have parent $1$.  
This satisfies the condition because vertex $1$ has $2$ children (a prime number), and vertices $2$ and $3$ both have $0$ children.  
This is the only rooted tree that satisfies the condition.
Input #2
123456
Output #2
607180670
API Response (JSON)
{
  "problem": {
    "name": "Rooted Tree",
    "description": {
      "content": "Consider rooted trees with $N$ vertices, where the vertices are labeled $1$ through $N$, and vertex $1$ is the root.   Count how many such rooted trees satisfy the following condition, and output the ",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 3000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "fps_24_o"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Consider rooted trees with $N$ vertices, where the vertices are labeled $1$ through $N$, and vertex $1$ is the root.  \nCount how many such rooted trees satisfy the following condition, and output the ...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments