[go: up one dir, main page]

login
A372897
Count of n-digit numbers whose sum of digits is a prime.
1
4, 33, 303, 2670, 23741, 222638, 2211826, 22325173, 220321667, 2128051302, 20606839279, 203631013986, 2048538361591, 20655036405780, 205672896661755, 2012878671315492, 19505453673514959, 190027534666354756, 1884928265282803982, 19032829919297816897, 193085599933330233795
OFFSET
1,1
COMMENTS
a(n) is the number of terms in A028834 with n digits.
Sum of digits s in n digits is a composition of s into n parts the first of which ranges 1 to 9 and the rest 0 to 9. The number of such compositions is the coefficient of x^s in polynomial (x^1 + ... + x^9)*(x^0 + ... + x^9)^(n-1) and a(n) is the sum of those coefficients where s is prime. - Kevin Ryde, May 19 2024
a(554) is the first term for which number_of_digits(a(n)) != n. - Antoine Mathys, May 22 2024
LINKS
EXAMPLE
For n=1 the a(1)=4 numbers are 2,3,5,7.
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 *)
PROG
(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;
CROSSREFS
Sequence in context: A237872 A123780 A054371 * A028576 A093185 A198006
KEYWORD
nonn,base
AUTHOR
Antoine Mathys, May 15 2024
EXTENSIONS
a(12)-a(21) from Stefano Spezia, May 16 2024
STATUS
approved