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.

A376128 The absolute difference of two successive terms is prime and the absolute difference of two successive digits is also prime.

Original entry on oeis.org

0, 2, 4, 1, 3, 5, 7, 9, 6, 8, 13, 16, 14, 25, 20, 27, 24, 29, 42, 47, 49, 46, 35, 30, 53, 50, 31, 36, 38, 57, 52, 41, 64, 61, 63, 58, 69, 72, 70, 75, 86, 81, 68, 135, 74, 79, 242, 469, 246, 83, 85, 252, 425, 202, 413, 130, 203, 136, 131, 358, 147, 94, 92, 97, 270, 241, 302, 429, 250, 207, 205, 258, 149
Offset: 1

Views

Author

Eric Angelini and Jean-Marc Falcoz, Sep 11 2024

Keywords

Examples

			Terms a(1) to a(15) are 0,2,4,1,3,5,7,9,6,8,13,16,14,25,20.
The successive absolute differences between two terms are the primes 2,2,3,2,2,2,2,3,2,5,3,2,11,5.
The successive absolute differences between two digits are the primes 2,2,3,2,2,2,2,3,2,7,2,2,5,5,3,2,3,3,2.
		

Crossrefs

Programs

  • Python
    # uses A219248gen in A219248
    from sympy import isprime
    from itertools import count, islice
    def c(an, k):
        return isprime(abs(an-k)) and isprime(abs(an%10-int(str(k)[0])))
    def agen(): # generator of terms
        an, aset = 0, {0}
        while True:
            yield an
            an = next(k for k in A219248gen(seed=str(an%10)) if k not in aset and c(an, k))
            aset.add(an)
    print(list(islice(agen(), 73))) # Michael S. Branicky, Sep 11 2024