OFFSET
1,1
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.
LINKS
C. A. Pickover, "Wonders of Numbers, Adventures in Mathematics, Mind and Meaning," Zentralblatt review
Eric Weisstein's World of Mathematics, Undulating Number.
PROG
(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
CROSSREFS
KEYWORD
nonn,base,more
AUTHOR
Patrick De Geest, Sep 15 2000
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
STATUS
approved