cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A332965 #9 Mar 08 2020 13:39:37
%S A332965 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 A332965 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 A332965 6,12,8,8,9,18,8,9,7,5,7,6,6,8,9,11,14,11
%N 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.
%C A332965 For any n > 0, the sequence s is eventually periodic, so this sequence is well defined.
%C A332965 a(n) tends to infinity as n tends to infinity.
%H A332965 Rémy Sigrist, <a href="/A332965/b332965.txt">Table of n, a(n) for n = 1..10000</a>
%F A332965 a(n) > k for any k >= 0 and n > A003095(k).
%e A332965 For n = 42:
%e A332965 - we have:
%e A332965   k  s(k)
%e A332965   -  ----
%e A332965   1     1
%e A332965   2     2
%e A332965   3     5
%e A332965   4    26
%e A332965   5     5
%e A332965   6    26
%e A332965   ...
%e A332965 - the sequence s has 4 distinct values, so a(42) = 4.
%o A332965 (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 A332965 Cf. A003095, A332966.
%K A332965 nonn
%O A332965 1,2
%A A332965 _Rémy Sigrist_, Mar 04 2020