OFFSET
1,3
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = A034387(n) mod n.
EXAMPLE
a(7) = (2+3+5+7) mod 7 = 17 mod 7 = 3.
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 *)
PROG
(Python) return (sum(i for i in range(n+1) if is_prime(i)) % n)
(PARI) a(n) = my(np=primepi(n)); vecsum(primes(np)) % n; \\ Michel Marcus, Apr 16 2020
CROSSREFS
KEYWORD
AUTHOR
Christoph Schreier, Apr 15 2020
STATUS
approved