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.

A334122 a(n) is the sum of all primes <= n, mod n.

Original entry on oeis.org

0, 0, 2, 1, 0, 4, 3, 1, 8, 7, 6, 4, 2, 13, 11, 9, 7, 4, 1, 17, 14, 11, 8, 4, 0, 22, 19, 16, 13, 9, 5, 0, 28, 24, 20, 16, 12, 7, 2, 37, 33, 28, 23, 17, 11, 5, 46, 40, 34, 28, 22, 16, 10, 3, 51, 45, 39, 33, 27, 20, 13, 5, 60, 53, 46, 39, 32, 24, 16, 8, 0, 63, 55
Offset: 1

Views

Author

Christoph Schreier, Apr 15 2020

Keywords

Examples

			a(7) = (2+3+5+7) mod 7 = 17 mod 7 = 3.
		

Crossrefs

Programs

  • Maple
    b:= proc(n) b(n):= `if`(n<2, 0, b(n-1)+`if`(isprime(n), n, 0)) end:
    a:= n-> irem(b(n), n):
    seq(a(n), n=1..80);  # Alois P. Heinz, Apr 15 2020
  • Mathematica
    Mod[Accumulate[(# * Boole @ PrimeQ[#]) & /@ (r = Range[100])], r] (* Amiram Eldar, Apr 15 2020 *)
  • PARI
    a(n) = my(np=primepi(n)); vecsum(primes(np)) % n; \\ Michel Marcus, Apr 16 2020
  • Python
    from sympy import primerange
    a = lambda n: sum(primerange(n + 1)) % n # David Radcliffe, May 10 2025
    

Formula

a(n) = A034387(n) mod n.