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.

A359813 Number of primes < 10^n with exactly one odd decimal digit.

This page as a plain text file.
%I A359813 #14 Feb 04 2023 20:43:00
%S A359813 3,12,45,171,619,2560,10774,46708,202635,904603,4073767,18604618,
%T A359813 85445767,395944114,1837763447,8600149593
%N A359813 Number of primes < 10^n with exactly one odd decimal digit.
%C A359813 a(n) =~ Pi(10^n)/2^(n-1). _Robert G. Wilson v_, Feb 04 2023
%e A359813 a(2)=12 as there are 12 primes less than 100 with exactly one odd decimal digit: 3, 5, 7, 23, 29, 41, 43, 47, 61, 67, 83, 89.
%t A359813 c=1; k=0; lst={}; f[n_] := Block[{e = 10 FromDigits[2 IntegerDigits[n, 5]]}, Length@ Select[e + {1, 3, 7, 9}, PrimeQ]];
%t A359813 Do[ While[k< 5^n, c+=f@k; k++]; Print[c], {n, 0, 16}] (* _Robert G. Wilson v_, Feb 04 2023 *)
%o A359813 (Python)
%o A359813 from sympy import isprime
%o A359813 from itertools import  product
%o A359813 def a(n):
%o A359813     c=3
%o A359813     if n==1:return(c)
%o A359813     x=[[1,7],[1,3,7,9],[3,9],'2468','02468']
%o A359813     for k in range(2,n+1):
%o A359813         for f in x[3]:
%o A359813             for m in product(x[4], repeat=k-2):
%o A359813                 s = int(f+"".join(m))*10
%o A359813                 t=s%3
%o A359813                 for last in x[t]:
%o A359813                     if isprime(s+last):
%o A359813                         c+= 1
%o A359813     return(c)
%o A359813 print([a(n) for n in range(1,7)])
%o A359813 (Python)
%o A359813 from sympy import primerange
%o A359813 def a(n):
%o A359813     p=list(primerange(3,10**n))
%o A359813     return(sum(1 for k in p if sum(str(k).count(d) for d in '13579')==1))
%o A359813 print([a(n) for n in range(1,7)])
%Y A359813 Cf. A030096, A068690, A154764, A358685, A358690.
%K A359813 base,nonn,more
%O A359813 1,1
%A A359813 _Zhining Yang_, Jan 14 2023
%E A359813 a(16) from _Robert G. Wilson v_, Feb 04 2023