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.

A071089 Remainder when sum of first n primes is divided by n-th prime.

Original entry on oeis.org

0, 2, 0, 3, 6, 2, 7, 1, 8, 13, 5, 12, 33, 23, 46, 10, 27, 13, 32, 0, 55, 1, 44, 73, 90, 50, 28, 87, 63, 11, 69, 17, 70, 42, 41, 11, 72, 139, 75, 146, 44, 8, 9, 164, 88, 48, 7, 201, 121, 79, 224, 92, 46, 57, 170, 26, 145, 95, 216, 112, 58, 71, 293, 185, 129, 13, 255, 81, 128
Offset: 1

Views

Author

Randy L. Ekl, May 26 2002

Keywords

Comments

Conjecture: Every nonnegative integer can appear in the sequence at most finitely many times. - Thomas Ordowski, Jul 22 2013
I conjecture the opposite. Heuristically a given number should appear log log x times below x. - Charles R Greathouse IV, Jul 22 2013
In the first 10000 terms, one sees a(n) = n for n=2,7,12. Does this ever happen again? - J. M. Bergot, Mar 26 2018
Yes, it happens for n = 83408, too. - Michel Marcus, Mar 27 2018

Examples

			a[5] = 6 because s[5] = 2+3+5+7+11 = 28, p[5]=11 and q[5]= floor(28/11)=2, so a[5] = 28-11*2 = 6.
		

Crossrefs

Programs

  • GAP
    P:=Filtered([1..1000],IsPrime);
    a:=List([1..70],i->Sum(P{[1..i]}) mod P[i]); # Muniru A Asiru, Mar 27 2018
  • Maple
    s:= proc(n) option remember; `if`(n=0, 0, ithprime(n)+s(n-1)) end:
    a:= n-> irem(s(n), ithprime(n)):
    seq(a(n), n=1..100);  # Alois P. Heinz, Mar 27 2018
  • Mathematica
    f[n_] := Mod[ Sum[ Prime[i], {i, 1, n - 1}], Prime[n]]; Table[ f[n], {n, 1, 70}] or
    a[1] = 0; a[n_] := Block[{s = Sum[Prime[i], {i, 1, n}]}, s - Prime[n]*Floor[s/Prime[n]]]; Table[ f[n], {n, 1, 70}]
    f[n_] := Mod[Plus @@ Prime@ Range@ n, Prime@ n]; Array[f, 70] (* Robert G. Wilson v, Nov 12 2016 *)
    Module[{nn=70,t},t=Accumulate[Prime[Range[nn]]];Mod[#[[1]],#[[2]]]&/@ Thread[ {t,Prime[Range[nn]]}]] (* Harvey P. Dale, Sep 19 2019 *)
  • PARI
    for(n=1,100,s=sum(i=1,n, prime(i)); print1(s-prime(n)*floor(s/prime(n)),","))
    
  • PARI
    a(n) = vecsum(primes(n)) % prime(n); \\ Michel Marcus, Mar 27 2018
    

Formula

a(n) = s[n] - p[n]*q[n], where s[n] = sum of first n primes, p[n] is n-th prime and q[n] is floor(s[n]/p[n]).
a(A024011(n)) = 0. - Michel Marcus, Jan 22 2015

Extensions

Edited by Robert G. Wilson v and Benoit Cloitre, May 30 2002