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.
%I A308964 #42 Oct 23 2019 16:37:36 %S A308964 1,1,1,1,2,1,2,1,2,2,3,1,2,2,2,2,3,2,3,2,2,3,4,1,3,2,2,2,3,2,3,2,3,3, %T A308964 2,2,3,3,2,2,2,2,3,3,2,4,5,2,3,3,3,2,3,2,3,2,3,3,4,2,3,3,2,3,2,3,4,3, %U A308964 4,2,3,2,2,3,3,3,3,2,3,2,3,2,3,2,3,3,3 %N A308964 Least k > 0 such that A014222(k) == A014222(k+1) (mod n). %C A308964 a(n) is the least positive integer k such that the sequence {A014222(i) mod n} for i >= k is constant. Proof: if g(i) = A014222(i), then n divides 3^g(i-1)*(3^(g(i)-g(i-1)) - 1) when g(i) == g(i+1) (mod n). g(j)-g(j-1) divides g(j+1)-g(j) for any j > 0, therefore, 3^(g(i)-g(i-1)) - 1 divides 3^(g(i+1)-g(i)) - 1. Then n divides 3^g(i)*(3^(g(i+1)-g(i)) - 1) = g(i+2) - g(i+1), that is, g(i) == g(i+1) == g(i+2) (mod n). Since a(n) is the least positive integer k such that g(k) == g(k+1) (mod n), the sequence {A014222(i) mod n} for i >= k is constant. %C A308964 A014222(k+1) - A014222(k) is the largest n such that a(n) = k. %F A308964 a(n) <= A003434(n). %F A308964 a(n) <= a(A000010(n)) + 1. %e A308964 3, 27, 7625597484987, ... mod 5 equal 3, 2, 2, ..., so A014222(k) mod 5 = 2 for all k >= 2, hence a(5) = 2. %o A308964 (PARI) a(n) = {my(c=0, k=1, x=0, d=n); while(k==1, z=x++; y=0; b=1; while(z>0, while(y++<z, d=eulerphi(d)); b=3^b-floor((3^b-1)/d)*d; z=z-1; y=0; d=n); if(c==b, k=0); c=b); x-1; } %Y A308964 Cf. A014222, A308972, A322418. %K A308964 nonn %O A308964 1,5 %A A308964 _Jinyuan Wang_, Aug 30 2019