login
A330405
a(1) = 0; thereafter a(n) = (a(n-1)^2+1) mod n.
2
0, 1, 2, 1, 2, 5, 5, 2, 5, 6, 4, 5, 0, 1, 2, 5, 9, 10, 6, 17, 17, 4, 17, 2, 5, 0, 1, 2, 5, 26, 26, 5, 26, 31, 17, 2, 5, 26, 14, 37, 17, 38, 26, 17, 20, 33, 9, 34, 30, 1, 2, 5, 26, 29, 17, 10, 44, 23, 58, 5, 26, 57, 37, 26, 27, 4, 17, 18, 49, 22, 59, 26, 20, 31, 62, 45, 24
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
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
Sequence in context: A277741 A241138 A241349 * A111934 A098509 A019910
KEYWORD
easy,nonn
AUTHOR
Matthew Ryan, Dec 12 2019
STATUS
approved