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.

A262744 Remainder when sum of first n primes is divided by n-th triangular number.

Original entry on oeis.org

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

Views

Author

Altug Alkan, Sep 29 2015

Keywords

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).

Examples

			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.
		

Crossrefs

Programs

  • 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 *)
  • PARI
    a(n) = sum(k=1, n, prime(k)) % (n*(n+1)/2);
    vector(500, n, a(n))

Formula

a(n) = (Sum_{k=1..n} prime(k)) mod (n*(n+1)/2).
a(n) = A007504(n) mod A000217(n).

Extensions

New name from Altug Alkan, Feb 06 2017, following a suggestion from N. J. A. Sloane