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 A366475 #28 Oct 28 2023 00:25:07 %S A366475 1,2,2,0,1,0,1,2,2,1,2,0,1,0,1,0,1,0,1,0,1,2,0,1,0,1,2,3,0,2,0,1,0,1, %T A366475 0,2,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1, %U A366475 0,1,0,1,0,1,0,1,0,1,2,0,1,2,2,1,2,1,2,0,1,2,0,2,0 %N A366475 a(n) = (A364054(n) - A366470(n))/prime(n-1). %C A366475 a(29) = 3. When, if ever, does 4 appear? %C A366475 Answer: a(28025) = 4. - _Michael De Vlieger_, Oct 26 2023 %H A366475 Michael De Vlieger, <a href="/A366475/b366475.txt">Table of n, a(n) for n = 2..65536</a> %H A366475 Michael De Vlieger, <a href="/A366475/a366475.png">2048 X 2048 raster showing a(n)</a>, n = 1..4194304 in rows of 2048 terms, left to right, then continued below for 2048 rows total. Color indicates terms as follows: black = 0, blue = 1, green = 2, gold = 3, red = 4. %e A366475 n p(n-1) x y a(n) [x = A364054(n), y = A366470(n)] %e A366475 1 (1) 1 - - [a(n) = (x-y)/p(n-1)] %e A366475 2 2 3 1 1 %e A366475 3 3 6 0 2 %e A366475 4 5 11 1 2 %e A366475 5 7 4 4 0 %e A366475 6 11 15 4 1 %e A366475 7 13 2 2 0 %e A366475 ... %t A366475 nn = 2^20; %t A366475 c[_] := False; m[_] := 0; a[1] = j = 1; c[0] = c[1] = True; %t A366475 Monitor[Do[p = Prime[n - 1]; r = Mod[j, p]; %t A366475 While[Set[k, p m[p] + r ]; c[k], m[p]++]; %t A366475 Set[{a[n], b[n], c[k], j}, {k, m[p], True, k}], {n, 2, nn}], n]; %t A366475 Array[b, nn-1, 2] (* _Michael De Vlieger_, Oct 26 2023 *) %o A366475 (Python) %o A366475 from itertools import count, islice %o A366475 from sympy import nextprime %o A366475 def A366475_gen(): # generator of terms %o A366475 a, aset, p = 1, {0,1}, 1 %o A366475 while True: %o A366475 p = nextprime(p) %o A366475 b = a%p %o A366475 for i in count(0): %o A366475 if b not in aset: %o A366475 aset.add(b) %o A366475 a = b %o A366475 break %o A366475 b += p %o A366475 yield i %o A366475 A366475_list = list(islice(A366475_gen(),30)) # _Chai Wah Wu_, Oct 27 2023 %Y A366475 Cf. A364054, A366470, A366477 (records). %K A366475 nonn %O A366475 2,2 %A A366475 _N. J. A. Sloane_, Oct 26 2023