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.

A366475 a(n) = (A364054(n) - A366470(n))/prime(n-1).

Original entry on oeis.org

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, 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, 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
Offset: 2

Views

Author

N. J. A. Sloane, Oct 26 2023

Keywords

Comments

a(29) = 3. When, if ever, does 4 appear?
Answer: a(28025) = 4. - Michael De Vlieger, Oct 26 2023

Examples

			   n p(n-1)  x   y  a(n)  [x = A364054(n), y = A366470(n)]
   1   (1)   1   -   -    [a(n) = (x-y)/p(n-1)]
   2    2    3   1   1
   3    3    6   0   2
   4    5   11   1   2
   5    7    4   4   0
   6   11   15   4   1
   7   13    2   2   0
...
		

Crossrefs

Cf. A364054, A366470, A366477 (records).

Programs

  • Mathematica
    nn = 2^20;
      c[] := False; m[] := 0; a[1] = j = 1; c[0] = c[1] = True;
      Monitor[Do[p = Prime[n - 1]; r = Mod[j, p];
        While[Set[k, p m[p] + r ]; c[k], m[p]++];
        Set[{a[n], b[n], c[k], j}, {k, m[p], True, k}], {n, 2, nn}], n];
    Array[b, nn-1, 2] (* Michael De Vlieger, Oct 26 2023 *)
  • Python
    from itertools import count, islice
    from sympy import nextprime
    def A366475_gen(): # generator of terms
        a, aset, p = 1, {0,1}, 1
        while True:
            p = nextprime(p)
            b = a%p
            for i in count(0):
                if b not in aset:
                    aset.add(b)
                    a = b
                    break
                b += p
            yield i
    A366475_list = list(islice(A366475_gen(),30)) # Chai Wah Wu, Oct 27 2023