login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A332965 a(n) is the number of distinct values in the sequence s defined by s(1) = 0 and for any k > 0, s(k+1) = (s(k)^2+1) mod n. 2

%I #9 Mar 08 2020 13:39:37

%S 1,2,3,3,3,4,4,4,5,6,6,4,4,5,5,5,8,8,6,7,4,6,8,4,4,4,5,5,11,8,5,5,6,8,

%T 6,8,6,7,6,8,7,5,8,6,5,8,14,5,9,7,8,5,9,8,10,5,6,11,11,8,15,6,6,6,12,

%U 6,12,8,8,9,18,8,9,7,5,7,6,6,8,9,11,14,11

%N a(n) is the number of distinct values in the sequence s defined by s(1) = 0 and for any k > 0, s(k+1) = (s(k)^2+1) mod n.

%C For any n > 0, the sequence s is eventually periodic, so this sequence is well defined.

%C a(n) tends to infinity as n tends to infinity.

%H Rémy Sigrist, <a href="/A332965/b332965.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) > k for any k >= 0 and n > A003095(k).

%e For n = 42:

%e - we have:

%e k s(k)

%e - ----

%e 1 1

%e 2 2

%e 3 5

%e 4 26

%e 5 5

%e 6 26

%e ...

%e - the sequence s has 4 distinct values, so a(42) = 4.

%o (PARI) a(n) = { my (s=0, v=0, w=0); while (!bittest(w,s), w+=2^s; v++; s=(s^2+1)%n); v }

%Y Cf. A003095, A332966.

%K nonn

%O 1,2

%A _Rémy Sigrist_, Mar 04 2020

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 23:26 EDT 2024. Contains 371917 sequences. (Running on oeis4.)