login
Difference between the sum of the first n primes s(n) and the nearest square < s(n).
1

%I #5 May 21 2012 12:55:36

%S 1,1,1,1,3,5,9,13,19,8,16,1,13,25,4,20,40,17,39,14,36,7,33,2,36,5,39,

%T 2,36,72,39,2,52,11,67,26,84,43,105,62,17,83,38,110,59,2,82,37,127,76,

%U 21,113,54,152,97,40,146,85,22,130,61,175,118,57,181,114

%N Difference between the sum of the first n primes s(n) and the nearest square < s(n).

%C Let A007504(n) the sum of the first n primes. It is proved that between the numbers A007504(n) and A007504(n+1) there must be a square integer.

%C The sum of the first n primes is asymptotically equivalent to (1/2)*log(n)*n^2.

%H Michel Lagneau, <a href="/A212530/b212530.txt">Table of n, a(n) for n = 1..10000</a>

%e a(5) = 3 because the sum of the 5 primes 2 + 3 + 5 + 7 + 11 = 28, and 28 - 25 = 3.

%p with(numtheory): for n from 1 to 100 do:s:=sum(‘ithprime(k)’,’k’=1..n):x:=s -floor(sqrt(s-1))^2: printf(`%d, `,x):od:

%Y Cf. A007504.

%K nonn

%O 1,5

%A _Michel Lagneau_, May 20 2012