OFFSET
1,3
COMMENTS
Does the value 0 appear infinitely many times? - Rémy Sigrist, Dec 16 2019
From Michael De Vlieger, Jan 26 2020: (Start)
Observations based on a(n) for 1 <= n <= 300000:
The value 0 appears at indices n = {1, 13, 26, 89, 205, 530, 2041, 276205, ...}.
The value 1 appears at indices n = {2, 4, 14, 27, 50, 90, 99, 175, 188, 206, 531, 2042, 5445, 6845, 7200, 18225, 24389, 25215, 37538, 46875, 48672, 53066, 79527, 93900, 147875, 176267, 186576, 196025, 254457, 276206, ...}. Let M be the indices in a(n) where 1 appears.
The subsequence {1, 2, 5, 26} appears with the first term at index n = 27, and apparently for all subsequent indices listed n M.
The subsequence {1, 2, 5, 26, 677} appears with the first term at index n = 2042, and apparently for all subsequent indices listed n M.
A stable next term in the subsequence S = {1, 2, 5, 26, 677} is not yet apparent, given 300000 terms of a(n). (End)
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..10000
FORMULA
a(1) = 0; a(n) = (a(n-1)^2+1) mod n.
EXAMPLE
a(1) = 0; a(2) = (0^2+1) mod 2 = 1; a(3) = (1^2+1) mod 2 = 2.
MATHEMATICA
Nest[Append[#1, Mod[#1[[#2 - 1]]^2 + 1, #2]] & @@ {#, Length@ # + 1} &, {0}, 76] (* Michael De Vlieger, Dec 16 2019 *)
PROG
(PARI) v=0; for (n=1, 77, print1 (v=(v^2+1)%n", ")) \\ Rémy Sigrist, Dec 16 2019
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Matthew Ryan, Dec 12 2019
STATUS
approved