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.

A057333 Numbers of n-digit primes that undulate.

Original entry on oeis.org

4, 20, 74, 347, 1743, 8385, 44355, 229952, 1235489, 6629026, 37152645, 202017712, 1142393492, 6333190658
Offset: 1

Views

Author

Patrick De Geest, Sep 15 2000

Keywords

Comments

'Undulate' means that the alternate digits are consistently greater than or less than the digits adjacent to them (e.g., 70769). Smoothly undulating palindromic primes (e.g., 95959) are a subset and included in the count.

References

  • C. A. Pickover, "Wonders of Numbers", Oxford New York 2001, Chapter 52, pp. 123-124, 316-317.

Crossrefs

Programs

  • Python
    from sympy import isprime
    def f(w,dir):
        if dir == 1:
            for s in w:
                for t in range(int(s[-1])+1,10):
                    yield s+str(t)
        else:
            for s in w:
                for t in range(0,int(s[-1])):
                    yield s+str(t)
    def A057333(n):
        c = 0
        for d in '123456789':
            x = d
            for i in range(1,n):
                x = f(x,(-1)**i)
            c += sum(1 for p in x if isprime(int(p)))
            if n > 1:
                y = d
                for i in range(1,n):
                    y = f(y,(-1)**(i+1))
                c += sum(1 for p in y if isprime(int(p)))
        return c # Chai Wah Wu, Apr 25 2021

Extensions

Offset corrected and a(10)-a(11) from Donovan Johnson, Aug 08 2010
a(12) from Giovanni Resta, Feb 24 2013
a(2) corrected by Chai Wah Wu, Apr 25 2021
a(13)-a(14) from Chai Wah Wu, May 02 2021