A057333 Numbers of n-digit primes that undulate.
4, 20, 74, 347, 1743, 8385, 44355, 229952, 1235489, 6629026, 37152645, 202017712, 1142393492, 6333190658
Offset: 1
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.
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
Comments