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.

A358685 Number of primes < 10^n whose digits are all odd.

This page as a plain text file.
%I A358685 #43 Dec 22 2022 02:12:58
%S A358685 3,15,57,182,790,3217,13298,56866,254689,1128121,5106701,23266331,
%T A358685 107019385,494689488,2306491761,10758057302,50548874979
%N A358685 Number of primes < 10^n whose digits are all odd.
%H A358685 BBS Math Blog, <a href="https://bbs.emath.ac.cn/thread-18361-1-1.html">How many prime numbers are all composed of 1,3,5,7,9?</a> (in Chinese).
%e A358685 a(2) = 15 as there are 15 primes less than 100 whose digits are all odd: 3, 5, 7, 11, 13, 17, 19, 31, 37, 53, 59, 71, 73, 79, 97.
%t A358685 n=7
%t A358685 Length[Select[Prime[Range[PrimePi[10^n]]], And @@ OddQ[IntegerDigits[#]] &]] (* _Zhining Yang_, Nov 26 2022 *)
%t A358685 n = PrimePi[10^8];
%t A358685 Sum[If[MemberQ[IntegerDigits[Prime[i]], _?EvenQ], 0, 1], {i, 1, n}]
%t A358685 (* _Jianlin Su_, Nov 27 2022 *)
%o A358685 (Python)
%o A358685 from sympy import primerange
%o A358685 def a(n):
%o A358685     p=list(primerange(3,10**n))
%o A358685     return(sum(1 for k in p if all(int(d) %2 for d in str(k))==True))
%o A358685 print ([a(n) for n in range(1,8)])
%o A358685 (Python)
%o A358685 from sympy import isprime
%o A358685 from itertools import count, islice, product
%o A358685 def agen(): # generator of terms
%o A358685     c = 3
%o A358685     for d in count(2):
%o A358685         yield c
%o A358685         for p in product("13579", repeat=d-1):
%o A358685             s = "".join(p)
%o A358685             for last in "1379":
%o A358685                 if isprime(int(s+last)): c += 1
%o A358685 print(list(islice(agen(), 9))) # _Michael S. Branicky_, Nov 27 2022
%Y A358685 Cf. A030096, A358690.
%K A358685 base,nonn,more
%O A358685 1,1
%A A358685 _Zhining Yang_, Nov 26 2022
%E A358685 a(10)-a(14) from _Michael S. Branicky_, Nov 26 2022
%E A358685 a(15) from _Zhining Yang_, Dec 21 2022
%E A358685 a(16)-a(17) from _Martin Ehrenstein_, Dec 21 2022