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.
%I A073902 #30 Aug 02 2022 17:17:25 %S A073902 0,1,0,4,12,0,95,212,0,2395,10657,0,126068,375941,0,4943357,20513691, %T A073902 0,271911476 %N A073902 Number of n-digit primes with digit sum n. %C A073902 a(3n) = 0. - _Sascha Kurz_, Aug 23 2002 %e A073902 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. %t A073902 Table[Length[Select[Prime[Range[PrimePi[10^(n-1)]+1,PrimePi[10^n]]], Total[IntegerDigits[#]]==n&]],{n,8}] (* _Harvey P. Dale_, Aug 09 2011 *) %o A073902 (Python) %o A073902 from sympy import isprime %o A073902 def nextsod(n, base): %o A073902 c, b, w = 0, base, 0 %o A073902 while True: %o A073902 d = n%b %o A073902 if d+1 < b and c: %o A073902 return (n+1)*b**w + ((c-1)%(b-1)+1)*b**((c-1)//(b-1))-1 %o A073902 c += d; n //= b; w += 1 %o A073902 def a(n): %o A073902 if n%3 == 0: return 0 %o A073902 c, t = 0, 10**(n-1) + ((n-1)%9+1)*10**((n-1)//9)-1 %o A073902 while t < 10**n: %o A073902 if isprime(t): c += 1 %o A073902 t = nextsod(t, 10) %o A073902 return c %o A073902 print([a(n) for n in range(1, 13)]) # _Michael S. Branicky_, Aug 02 2022 %Y A073902 Cf. A069710. %K A073902 base,nonn %O A073902 1,4 %A A073902 _Amarnath Murthy_, Aug 18 2002 %E A073902 More terms from _Sascha Kurz_, Aug 23 2002 %E A073902 a(4) and a(5) corrected, and example corrected, by _Harvey P. Dale_, Aug 09 2011 %E A073902 a(11) corrected and a(13)-a(15) from _Donovan Johnson_, Aug 10 2011 %E A073902 a(16)-a(18) from _David Radcliffe_, May 05 2015 %E A073902 a(19) from _Michael S. Branicky_, Aug 02 2022