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.

A343676 Number of n-digit undulating alternating primes.

This page as a plain text file.
%I A343676 #19 Apr 27 2021 07:54:55
%S A343676 4,9,23,49,175,321,1189,3025,12111,28492,113409,251513,1068440,
%T A343676 2629980,11690210,28498852,128871588,298890814,1309837146
%N A343676 Number of n-digit undulating alternating primes.
%C A343676 a(n) is the number of n-digit terms in A343590.
%C A343676 a(n) <= A057333(n).
%o A343676 (Python)
%o A343676 def f(w):
%o A343676     for s in w:
%o A343676         for t in range(int(s[-1])+1,10,2):
%o A343676             yield s+str(t)
%o A343676 def g(w):
%o A343676     for s in w:
%o A343676         for t in range(1-int(s[-1])%2,int(s[-1]),2):
%o A343676             yield s+str(t)
%o A343676 def A343676(n):
%o A343676     c = 0
%o A343676     for d in '123456789':
%o A343676         x = d
%o A343676         for i in range(1,n):
%o A343676             x = g(x) if i % 2 else f(x)
%o A343676         c += sum(1 for p in x if isprime(int(p)))
%o A343676         if n > 1:
%o A343676             y = d
%o A343676             for i in range(1,n):
%o A343676                 y = f(y) if i % 2 else g(y)
%o A343676             c += sum(1 for p in y if isprime(int(p)))
%o A343676     return c
%Y A343676 Cf. A002385, A030144, A057333, A059168, A343590, A343675.
%K A343676 nonn,base,more
%O A343676 1,1
%A A343676 _Chai Wah Wu_, Apr 25 2021
%E A343676 a(18)-a(19) from _Martin Ehrenstein_, Apr 27 2021