If any of the following exposition is unclear, please write a comment.
In essence, I am looking at the graph $G$ that is generated by the polynomial $q(x) = x^2+ax+b$ ($a,b \in \mathbb{Z}$) via the edge set $$\{(n, q(n) \text{ mod } p) : n =0,\ldots,p-1\}$$ for some prime $p \in \mathbb{P}$. After some thought, it should be clear that the statements $$``\text{Iterating } q \text{ for any input will always eventually lead to divisibility by some prime at least once.} ``$$ and $$``G \text{ has a path from any node to 0.}``$$ are equivalent. Furthermore, "at least once" can be replaced by "periodically infinitely many times" and "every node has a path to $0$" can be characterized by "$G$ is weakly connected and has exactly one loop containing $0$". With that out of the way, let's get to the question:
The natural question now is to know for which polynomials $q$ we have this nice property of "eventual divisibility" by some prime no matter what number we input, i.e. finding connected $G$ with a single loop containing $0$. This is not rare, see for example $q(x) = x^2+3$ for $p=7$:
To get a feeling for how rare this is, let's look at the following plot:
This image displays, for $a = -10, \ldots, 10$ on the vertical axis and $b = -10, \ldots, 10$ on the horizontal axis, if $G$ has the aforementioned property for some $p < 113$ in black and otherwise white. There are some obvious cases like $a = b+2$ and $a = -b$ where this eventual divisibility will never occur since they have the one-cycles $(-1,-1)$ and $(1,1)$ respectively.
Modulo careful checking, we can eliminate quite a lot more trivial cases (i.e. explain white squares) in the diagram by searching for trivial one- and two-cycles, i.e. eventual divisibility seems to be the norm rather than the exception. In some other cases, eventual divisibility is found with a somewhat higher prime, such as $p=719$ for $x^2+5x+9$. Sparing you the details, we are left with the cases below, in which either eventual divisibility does not exist or it requires an especially large prime. The discriminant $\Delta$ is included if it helps:
- $x^2-10x-10$ (EDIT) is "eventually divisible" for every residue with $p = 11701$
- $x^2-10x-6$ (EDIT) is "eventually divisible" for every residue with $p = 31237$
- $x^2-10x+4$ (EDIT) is "eventually divisible" for every residue with $p = 6337$
- $x^2-10x+8$ (EDIT) is "eventually divisible" for every residue with $p = 13037$
- $x^2-7x-7$ checked for $p \leq 4\cdot10^6$ by Mike Daas ($\Delta = 77$)
- $x^2-7x+5$ checked for $p \leq 6881261$ by Mike Daas ($\Delta = 29$)
- $x^2+5x+7$ is provably never "eventually divisible" as shown by Oscar Lanzi
Five of the seven cases above have been solved as indicated, but for the remaining two I cannot rule in or rule out this property. I know that this is a question about (pretty much hopelessly) chaotic behaviour, but perchance somebody has a thought or two on the following:
Since eventual divisibility seems to be occuring by pure chance every time, why do these exceptions stick out so much? Is there some anti-"strong law of small numbers" at work here? If so, are the heuristics that might suggest non-existence of such $G$ for given $q$?


We will never achieve eventual divisibility with $x^2+5x+7$. Cases $p=2$ and $p=3$ fail easily, so we must accept $p>3$ and then reckon with the cases below.
Suppose $p=3k+1$. Then we will have an "isolated" nonzero residue if any such residue solves $x^2+5x+7\equiv x$, thus $x^2+4x+7\equiv 0$. But $x^2+4x+7$ has discriminant $-12$ which is a quadratic residue $\bmod p=3k+1$. So isolated nonzero residues always exist. (The case $p=7$ does give a zero root, but the other root is nonzero.)
Suppose $3k-1$ instead. This time we cannot identify isolated residues, but then $x^2+5x+7$ has discriminant $-3$ which is not a quadratic residue $\bmod p=3k-1$. We can of course try zero residue as an initial condition but would never be able to regenerate it.
The case $x^2+5x+7$ is not unique; a similar result is obtainable whenever we specify $x^2+ax+b$ with $(a-1)^2-4b$ a rational square times $a^2-4b$ and $p=2$ fails. The reader is invited to test this using $x^2+17x+75$.
A second approach, which works on some other quadratic function iterations, involves using discriminants to show a contradiction between eventual divisibility and the existence of 2-cycles. Given a quadratic iteration function $x^2+ax+b$, the roots for primitive 2-cycles (not those where a single invariant residue is simply repeated twice) is
$x^2+(a+1)x+(a+b+1)\equiv0.$
If $a$ and $b$ have a right parity combination to avoid eventual divisibility with $p=2$, then a proof similar to the one above may be set up whenever the discriminant for the above equation is a rational square times the $a^2-4b$ discrimiant from the iteration function. However, we still must explicitly test prime factors of the constant term $a+b+1$ for which residue $0$ is part of the 2-cycle. An example is provided by the iteration of $x^2-9x+19$ for which the primitive 2-cycle equation becomes $x^2-8x+11\equiv0$. These have discriminants $5$ and $20=4×5$ respectively, so we either have a 2-cycle if $p$ is a quadratic residue $\bmod 5$ or no chance for a zero residue if $p$ is a nonquadratic residue (the double root at $p=5$ is nonzero and thus of no consequence). But we must still test $p=11$ explicitly because residue $0$ appears in the 2-cycle. In this example nondivisibility holds with other residues $\bmod11$, but a similar analysis with $x^2+3x+3$ reveals that eventual divisibility slips through for (only) $p=7$.