A372897 Count of n-digit numbers whose sum of digits is a prime.
4, 33, 303, 2670, 23741, 222638, 2211826, 22325173, 220321667, 2128051302, 20606839279, 203631013986, 2048538361591, 20655036405780, 205672896661755, 2012878671315492, 19505453673514959, 190027534666354756, 1884928265282803982, 19032829919297816897, 193085599933330233795
Offset: 1
Examples
For n=1 the a(1)=4 numbers are 2,3,5,7.
Links
- Antoine Mathys, Table of n, a(n) for n = 1..1000
Programs
-
Mathematica
a[n_]:=Sum[Coefficient[Sum[x^i,{i,9}]Sum[x^i,{i,0,9}]^(n-1),x^i],{i,Prime[Range[PrimePi[9n]]]}]; Array[a,21] (* Stefano Spezia, May 16 2024 *)
-
PARI
a(n)=my(p=sum(i=1,9,x^i)*sum(i=0,9,x^i)^(n-1),s=0);forprime(q=2,9*n,s+=polcoef(p,q));s;
Extensions
a(12)-a(21) from Stefano Spezia, May 16 2024
Comments