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.

A366477 a(n) = smallest k such that A366475(k) >= n, or -1 if no such k exists.

This page as a plain text file.
%I A366477 #17 Oct 28 2023 14:40:57
%S A366477 2,3,29,28025,2467754261
%N A366477 a(n) = smallest k such that A366475(k) >= n, or -1 if no such k exists.
%t A366477 nn = 2^16; c[_] := False; m[_] := 0; j = 1; c[0] = c[1] = True; q[_] := 0; s = -1;
%t A366477   Monitor[Do[p = Prime[n - 1]; r = Mod[j, p];
%t A366477     While[Set[k, p m[p] + r ]; c[k], m[p]++];
%t A366477     (If[q[#] == 0, Set[q[#], n]]; If[# > s, s = #]) &[ m[p] ];
%t A366477     Set[{c[k], j}, {True, k}], {n, 2, nn}], n];
%t A366477 Array[q, s] (* _Michael De Vlieger_, Oct 27 2023 *)
%o A366477 (Python)
%o A366477 from itertools import count
%o A366477 from sympy import nextprime
%o A366477 def A366477(n):
%o A366477     a, aset, p = 1, {0,1}, 1
%o A366477     for i in count(2):
%o A366477         p = nextprime(p)
%o A366477         b = a%p
%o A366477         for j in count(0):
%o A366477             if b not in aset:
%o A366477                 aset.add(b)
%o A366477                 a = b
%o A366477                 break
%o A366477             b += p
%o A366477         if j>=n:
%o A366477             return i # _Chai Wah Wu_, Oct 27 2023
%Y A366477 Cf. A364054, A366475.
%K A366477 nonn,more
%O A366477 1,1
%A A366477 _N. J. A. Sloane_, Oct 26 2023
%E A366477 a(4) = 28025 from _Michael De Vlieger_, Oct 26 2023, who also reports that 5 does not appear in the first 2^24 terms of A366475.
%E A366477 a(5) from _Chai Wah Wu_, Oct 28 2023