login
Sum of digits of n-th prime.
(Formerly M0633)
91

%I M0633 #56 Oct 04 2024 05:43:58

%S 2,3,5,7,2,4,8,10,5,11,4,10,5,7,11,8,14,7,13,8,10,16,11,17,16,2,4,8,

%T 10,5,10,5,11,13,14,7,13,10,14,11,17,10,11,13,17,19,4,7,11,13,8,14,7,

%U 8,14,11,17,10,16,11,13,14,10,5,7,11,7,13,14,16,11,17,16,13,19,14,20,19,5

%N Sum of digits of n-th prime.

%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

%H Reinhard Zumkeller, <a href="/A007605/b007605.txt">Table of n, a(n) for n = 1..10000</a>

%H CNRS press release, <a href="http://www.sciencedaily.com/releases/2010/05/100512172533.htm">Sum of Digits of Prime Numbers Is Evenly Distributed: New Mathematical Proof of Hypothesis</a>

%H Christian Mauduit and Joël Rivat, <a href="http://dx.doi.org/10.4007/annals.2010.171.1591">Sur un problème de Gelfond: la somme des chiffres des nombres premiers</a> (French) [On a problem posed by Gelfond: the sum of digits of primes] Ann. of Math. (2) 171(2010), no. 3, 1591--1646. MR2680394 (2011j:11137)

%H R. G. Wilson, V, <a href="/A007605/a007605.pdf">Letter to C. A. Pickover, Mar. 1993</a>

%F a(n) = A007953(A000040(n)) = A007953(prime(n)).

%p map(t -> convert(convert(t,base,10),`+`), select(isprime, [2,(2*i+1 $ i=1..1000)])); # _Robert Israel_, Aug 16 2015

%t Table[Apply[Plus, RealDigits[Prime[n]][[1]]], {n, 1, 100}]

%t Plus@@ IntegerDigits[Prime[Range[100]]] (* _Zak Seidov_ *)

%o (Magma) [ &+Intseq(NthPrime(n), 10): n in [1..80] ]; // _Klaus Brockhaus_, Jun 13 2009

%o (PARI) dsum(n)=my(s);while(n,s+=n%10;n\=10);s

%o forprime(p=2,1e3,print1(dsum(p)", ")) \\ _Charles R Greathouse IV_, Jul 15 2011

%o (PARI) a(n) = sumdigits(prime(n)); \\ _Michel Marcus_, Dec 20 2017

%o (Haskell)

%o a007605_list = map a007953 a000040_list -- _Reinhard Zumkeller_, Aug 04 2011

%o (Python)

%o from sympy import prime

%o def a(n): return sum(map(int, str(prime(n))))

%o print([a(n) for n in range(1, 80)]) # _Michael S. Branicky_, Feb 03 2021

%Y Cf. A000040, A007953, A038194, A065073, A068395, A133223, A376714.

%Y For inverse, see A067180 and A067523.

%K nonn,base,easy

%O 1,1

%A _N. J. A. Sloane_, _Mira Bernstein_, _Robert G. Wilson v_