Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Remainder when sum of squares of first n primes is divided by n-th prime.
2

%I #9 Jan 14 2023 08:45:57

%S 0,1,3,3,10,0,3,1,15,19,10,28,12,1,32,25,0,42,42,45,4,23,77,50,30,45,

%T 86,43,64,100,23,105,89,41,87,54,133,2,59,47,147,64,174,102,65,104,7,

%U 127,107,28,210,194,106,60,159,95,119,116,104,230,224,110,183,212,287

%N Remainder when sum of squares of first n primes is divided by n-th prime.

%F a(n) = s(n) - prime(n)*q(n), where s(n) = sum of squares of first n primes, prime(n) is n-th prime and q(n) is floor(s(n)/prime(n)).

%e a[3] = 3 because s[3] = 2*2 + 3*3 + 5*5 = 38, p[3]=5 and q[3]= floor(38/5)=7, so a[3] = 38-5*7 = 3.

%t Mod[#[[1]],#[[2]]]&/@With[{nn=70},Thread[{Accumulate[Prime[ Range[ nn]]^2], Prime[Range[nn]]}]] (* _Harvey P. Dale_, Aug 09 2015 *)

%o (PARI) a(n) = sum(k=1, n, prime(k)^2) % prime(n); \\ _Michel Marcus_, Jan 14 2023

%Y Cf. A024450 (s(n)).

%K easy,nonn

%O 1,3

%A _Randy L. Ekl_, Jun 18 2002