cp's OEIS Frontend

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.

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

Original entry on oeis.org

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

Views

Author

Randy L. Ekl, Jun 18 2002

Keywords

Examples

			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.
		

Crossrefs

Cf. A024450 (s(n)).

Programs

  • Mathematica
    Mod[#[[1]],#[[2]]]&/@With[{nn=70},Thread[{Accumulate[Prime[ Range[ nn]]^2], Prime[Range[nn]]}]] (* Harvey P. Dale, Aug 09 2015 *)
  • PARI
    a(n) = sum(k=1, n, prime(k)^2) % prime(n); \\ Michel Marcus, Jan 14 2023

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)).