OFFSET
1,3
COMMENTS
For any n > 0, the sequence s is eventually periodic, so this sequence is well defined.
a(n) tends to infinity as n tends to infinity.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..10000
Rémy Sigrist, Scatterplot of the first 750000 terms
EXAMPLE
For n = 42:
- we have:
k s(k)
- ----
1 1
2 2
3 5
4 26
5 5
6 26
...
- the sequence s has largest value 26, so a(42) = 26.
PROG
(PARI) a(n) = { my (s=0, v=s, w=0); while (!bittest(w, s), w+=2^s; v=max(v, s); s=(s^2+1)%n); v }
CROSSREFS
KEYWORD
nonn
AUTHOR
Rémy Sigrist, Mar 04 2020
STATUS
approved