

A262744


Remainder when sum of first n primes is divided by nth 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
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

Sequence is interesting because a(n)a(n1) < 0 in certain points such as n=7 and n=20, although a(n)a(n1) > 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


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(n1), 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

Cf. A007504, A000217, A090396.
Sequence in context: A002466 A162842 A164901 * A347703 A112997 A037032
Adjacent sequences: A262741 A262742 A262743 * A262745 A262746 A262747


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



