(In reply to
Generalised approach by broll)
Completing the picture:
Clearly, the function n^2 is cyclic mod any prime, P, with the cycle repeating after an interval of P. Similarly, the function n^2+k is normally just the same cycle, with an offset, except for the case already described. So if (4k+1) is prime, as in the example, it is not only the largest but actually the only prime having the desired property. It follows at once that no multiple of (4k+1) could divide {S(n), S(n+1)}, since this would imply that the function n^2+k was noncyclic mod at least 1 other prime, which we already know not to be the case.

Posted by broll
on 20141012 23:17:54 