OFFSET
1,2
COMMENTS
Sequence is interesting because a(n)-a(n-1) < 0 in certain points such as n=7 and n=20, although a(n)-a(n-1) > 0 for other points, generally.
Old name was: a(n) = (Sum_{k=1..n} prime(k)) mod (Sum_{k=1..n} k).
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
EXAMPLE
a(1) = prime(1) mod 1 = 0.
a(2) = (prime(1) + prime(2)) mod (1+2) = 2.
a(3) = (prime(1) + prime(2) + prime(3)) mod (1+2+3) = 4.
a(4) = (prime(1) + prime(2) + prime(3) + prime(4)) mod (1+2+3+4) = 7.
MAPLE
s:= proc(n) option remember; ithprime(n)+`if`(n>1, s(n-1), 0) end:
a:= n-> irem(s(n), n*(n+1)/2):
seq(a(n), n=1..70); # Alois P. Heinz, Oct 01 2015
MATHEMATICA
Table[Mod[Sum[Prime@ k, {k, n}], Sum[k, {k, n}]], {n, 60}] (* Michael De Vlieger, Sep 30 2015 *)
Module[{nn=60, pr, tr}, pr=Accumulate[Prime[Range[nn]]]; tr=Accumulate[ Range[ nn]]; Mod[#[[1]], #[[2]]]&/@Thread[{pr, tr}]] (* Harvey P. Dale, Aug 02 2020 *)
PROG
(PARI) a(n) = sum(k=1, n, prime(k)) % (n*(n+1)/2);
vector(500, n, a(n))
CROSSREFS
KEYWORD
AUTHOR
Altug Alkan, Sep 29 2015
EXTENSIONS
New name from Altug Alkan, Feb 06 2017, following a suggestion from N. J. A. Sloane
STATUS
approved