login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A073902 Number of n-digit primes with digit sum n. 0
0, 1, 0, 4, 12, 0, 95, 212, 0, 2395, 10657, 0, 126068, 375941, 0, 4943357, 20513691, 0, 271911476 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,4
COMMENTS
a(3n) = 0. - Sascha Kurz, Aug 23 2002
LINKS
EXAMPLE
a(2) = 1 because the only two-digit prime with digit sum 2 is 11. a(5) = 12: the primes are 10103, 10211, 10301, 11003, 12011, 12101, 13001, 20021, 20201, 21011, 21101, and 30011.
MATHEMATICA
Table[Length[Select[Prime[Range[PrimePi[10^(n-1)]+1, PrimePi[10^n]]], Total[IntegerDigits[#]]==n&]], {n, 8}] (* Harvey P. Dale, Aug 09 2011 *)
PROG
(Python)
from sympy import isprime
def nextsod(n, base):
c, b, w = 0, base, 0
while True:
d = n%b
if d+1 < b and c:
return (n+1)*b**w + ((c-1)%(b-1)+1)*b**((c-1)//(b-1))-1
c += d; n //= b; w += 1
def a(n):
if n%3 == 0: return 0
c, t = 0, 10**(n-1) + ((n-1)%9+1)*10**((n-1)//9)-1
while t < 10**n:
if isprime(t): c += 1
t = nextsod(t, 10)
return c
print([a(n) for n in range(1, 13)]) # Michael S. Branicky, Aug 02 2022
CROSSREFS
Cf. A069710.
Sequence in context: A099733 A350259 A330989 * A144207 A016487 A370707
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Aug 18 2002
EXTENSIONS
More terms from Sascha Kurz, Aug 23 2002
a(4) and a(5) corrected, and example corrected, by Harvey P. Dale, Aug 09 2011
a(11) corrected and a(13)-a(15) from Donovan Johnson, Aug 10 2011
a(16)-a(18) from David Radcliffe, May 05 2015
a(19) from Michael S. Branicky, Aug 02 2022
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 4 04:06 EDT 2024. Contains 373986 sequences. (Running on oeis4.)