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.

A112683 For each positive integer n, consider the ternary sequence given initially by x(i) = 0 if 1 <= i < n, x(n) = 1; and thereafter determined by the quadratic recurrence x(i) = x(i-1) + x(i-n)^2 mod 3. Define a(n) to be the smallest positive integer N for which x(N+i) = x(i) for all sufficiently large i.

This page as a plain text file.
%I A112683 #13 Jul 09 2025 04:25:24
%S A112683 1,4,4,9,19,4,4,22,36,4,4,45,64,4,4,102,182,213,4,188,272,4,412,225,
%T A112683 202,4,4,1444,512,4,4,840,1237,4,1138,362,1263,4,4,1536,672,1786,4,
%U A112683 701,741,4,4,2098,3921,5400,178,1183,2348,4,7698,6042,5091,4,4
%N A112683 For each positive integer n, consider the ternary sequence given initially by x(i) = 0 if 1 <= i < n, x(n) = 1; and thereafter determined by the quadratic recurrence x(i) = x(i-1) + x(i-n)^2 mod 3. Define a(n) to be the smallest positive integer N for which x(N+i) = x(i) for all sufficiently large i.
%D A112683 Terms computed by Bob Harder.
%H A112683 Steven R. Finch, <a href="http://www.people.fas.harvard.edu/~sfinch/csolve/seqmod3.pdf">Periodicity in Sequences Mod 3</a> [Broken link]
%H A112683 Steven R. Finch, <a href="https://web.archive.org/web/20150911081920/http://www.people.fas.harvard.edu/~sfinch/csolve/seqmod3.pdf">Periodicity in Sequences Mod 3</a> [From the Wayback machine]
%e A112683 For example, if n=4, then N=9, since the first 60 terms of x are:
%e A112683 0 0 0 1 1 1 1 2 0 1
%e A112683 2 0 0 1 2 2 2 0 1 2
%e A112683 0 0 1 2 2 2 0 1 2 0
%e A112683 0 1 2 2 2 0 1 2 0 0
%e A112683 1 2 2 2 0 1 2 0 0 1
%e A112683 2 2 2 0 1 2 0 0 1 2
%t A112683 period[lst_List] := Catch[lg = If[Length[lst] <= 5, 2, 40]; lst1 = lst[[1 ;; lg]]; km = Length[lst] - lg; Do[ If[lst1 == lst[[k ;; k+lg-1]], Throw[k-1]]; If[k == km, Throw[0]], {k, 2, km}]]; a[n_] := (ClearAll[x]; x[i_ /; 1 <= i < n] = 0; x[n] = 1; x[i_] := x[i] = Mod[x[i-1] + x[i-n]^2, 3]; xx = Table[x[i], {i, 1, 20000}]; period[xx // Reverse]); Table[a[n], {n, 1, 59}] (* _Jean-François Alcover_, Nov 30 2012 *)
%Y A112683 Cf. A112684, A112675.
%K A112683 nonn
%O A112683 1,2
%A A112683 _N. J. A. Sloane_, Dec 31 2005