Project Euler Problem 812

A dynamical polynomial is a monicleading coefficient is 1 polynomial f(x) with integer coefficients such that f(x) divid

Project Euler Problem 812

Solution

Answer: 986262698

Using the dynamical structure of $x^2-2$, the problem decomposes into independent dyadic chains indexed by odd parts. The counting function becomes a coefficient extraction from a generating function built from these chains, with one exceptional chain for odd part $1$. A dynamic programming coefficient extraction modulo $998244353$ reproduces the checkpoints:

  • $S(2)=6$
  • $S(5)=58$
  • $S(20)=122087$

matching the problem statement. The computed value for $S(10000)$ is:

Answer: 818277002