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.

This page as a plain text file.
%I A057333 #30 Feb 16 2025 08:32:43
%S A057333 4,20,74,347,1743,8385,44355,229952,1235489,6629026,37152645,
%T A057333 202017712,1142393492,6333190658
%N A057333 Numbers of n-digit primes that undulate.
%C A057333 '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.
%D A057333 C. A. Pickover, "Wonders of Numbers", Oxford New York 2001, Chapter 52, pp. 123-124, 316-317.
%H A057333 C. A. Pickover, "Wonders of Numbers, Adventures in Mathematics, Mind and Meaning," <a href="http://www.zentralblatt-math.org/zmath/en/search/?q=an:0983.00008&amp;format=complete">Zentralblatt review</a>
%H A057333 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/UndulatingNumber.html">Undulating Number.</a>
%o A057333 (Python)
%o A057333 from sympy import isprime
%o A057333 def f(w,dir):
%o A057333     if dir == 1:
%o A057333         for s in w:
%o A057333             for t in range(int(s[-1])+1,10):
%o A057333                 yield s+str(t)
%o A057333     else:
%o A057333         for s in w:
%o A057333             for t in range(0,int(s[-1])):
%o A057333                 yield s+str(t)
%o A057333 def A057333(n):
%o A057333     c = 0
%o A057333     for d in '123456789':
%o A057333         x = d
%o A057333         for i in range(1,n):
%o A057333             x = f(x,(-1)**i)
%o A057333         c += sum(1 for p in x if isprime(int(p)))
%o A057333         if n > 1:
%o A057333             y = d
%o A057333             for i in range(1,n):
%o A057333                 y = f(y,(-1)**(i+1))
%o A057333             c += sum(1 for p in y if isprime(int(p)))
%o A057333     return c # _Chai Wah Wu_, Apr 25 2021
%Y A057333 Cf. A046075, A033619, A032758, A039944, A016073, A046076, A046077, A057332.
%K A057333 nonn,base,more
%O A057333 1,1
%A A057333 _Patrick De Geest_, Sep 15 2000
%E A057333 Offset corrected and a(10)-a(11) from _Donovan Johnson_, Aug 08 2010
%E A057333 a(12) from _Giovanni Resta_, Feb 24 2013
%E A057333 a(2) corrected by _Chai Wah Wu_, Apr 25 2021
%E A057333 a(13)-a(14) from _Chai Wah Wu_, May 02 2021