login
A262744
Remainder when sum of first n primes is divided by n-th triangular number.
3
0, 2, 4, 7, 13, 20, 2, 5, 10, 19, 28, 41, 56, 71, 88, 109, 134, 159, 188, 9, 19, 32, 46, 63, 85, 108, 130, 153, 175, 198, 232, 267, 305, 342, 386, 429, 475, 524, 574, 627, 683, 738, 800, 861, 923, 984, 1054, 1133, 1213, 17, 46, 77, 106, 141, 178
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
FORMULA
a(n) = (Sum_{k=1..n} prime(k)) mod (n*(n+1)/2).
a(n) = A007504(n) mod A000217(n).
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
nonn,easy,look
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