Skip to main content
1 of 2
Max Alekseyev
  • 34.3k
  • 5
  • 74
  • 152

Using the notation from my answer to the previous question, we have $$D(n+1)−(D(n+2)+1)\not\equiv 0\pmod{p}$$ if and only if $g_0(n+2) = 2 g_0(n+1) - p$ and $g_1(n+2) \equiv 2 g_1(n+1) + 1\pmod{p}$, in which case $$D(n+2) \equiv -(n+2 + \frac{2 g_1(n+1) + 1}{2 g_0(n+1)})\equiv D(n+1) - 1 - \frac{1}{2 g_0(n+1)} \pmod{p}.$$ Similarly, $$D(n+2)−(D(n+3)+1)\not\equiv 0\pmod{p}$$ if and only if $$D(n+3) \equiv D(n+2) - 1 - \frac{1}{2 g_0(n+2)}\equiv D(n+2) - 1 - \frac{1}{4 g_0(n+1)}\pmod{p}.$$ If both these incongruences hold, then $$D(n+1) - 3D(n+2) + 2D(n+3) + 1 \equiv 0\pmod{p}$$ and so we can always take $(a_1,a_2,a_3,a_4)=(1,-3,2,1)$.

Max Alekseyev
  • 34.3k
  • 5
  • 74
  • 152