login
A072004
Remainder when sum of squares of first n primes is divided by n-th prime.
2
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, 86, 43, 64, 100, 23, 105, 89, 41, 87, 54, 133, 2, 59, 47, 147, 64, 174, 102, 65, 104, 7, 127, 107, 28, 210, 194, 106, 60, 159, 95, 119, 116, 104, 230, 224, 110, 183, 212, 287
OFFSET
1,3
FORMULA
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)).
EXAMPLE
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.
MATHEMATICA
Mod[#[[1]], #[[2]]]&/@With[{nn=70}, Thread[{Accumulate[Prime[ Range[ nn]]^2], Prime[Range[nn]]}]] (* Harvey P. Dale, Aug 09 2015 *)
PROG
(PARI) a(n) = sum(k=1, n, prime(k)^2) % prime(n); \\ Michel Marcus, Jan 14 2023
CROSSREFS
Cf. A024450 (s(n)).
Sequence in context: A165421 A227432 A100731 * A095271 A054511 A362469
KEYWORD
easy,nonn
AUTHOR
Randy L. Ekl, Jun 18 2002
STATUS
approved