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.

This page as a plain text file.
%I A334122 #60 May 10 2025 11:28:35
%S A334122 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,
%T A334122 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,
%U A334122 45,39,33,27,20,13,5,60,53,46,39,32,24,16,8,0,63,55
%N A334122 a(n) is the sum of all primes <= n, mod n.
%H A334122 Robert Israel, <a href="/A334122/b334122.txt">Table of n, a(n) for n = 1..10000</a>
%F A334122 a(n) = A034387(n) mod n.
%e A334122 a(7) = (2+3+5+7) mod 7 = 17 mod 7 = 3.
%p A334122 b:= proc(n) b(n):= `if`(n<2, 0, b(n-1)+`if`(isprime(n), n, 0)) end:
%p A334122 a:= n-> irem(b(n), n):
%p A334122 seq(a(n), n=1..80);  # _Alois P. Heinz_, Apr 15 2020
%t A334122 Mod[Accumulate[(# * Boole @ PrimeQ[#]) & /@ (r = Range[100])], r] (* _Amiram Eldar_, Apr 15 2020 *)
%o A334122 (Python) from sympy import primerange
%o A334122 a = lambda n: sum(primerange(n + 1)) % n # _David Radcliffe_, May 10 2025
%o A334122 (PARI) a(n) = my(np=primepi(n)); vecsum(primes(np)) % n; \\ _Michel Marcus_, Apr 16 2020
%Y A334122 Cf. A000720, A034387, A090396.
%K A334122 nonn,easy,look
%O A334122 1,3
%A A334122 _Christoph Schreier_, Apr 15 2020