login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A071089
Remainder when sum of first n primes is divided by n-th prime.
9
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,2
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
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
EXAMPLE
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.
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 *)
PROG
(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
(GAP) P:=Filtered([1..1000], IsPrime);
a:=List([1..70], i->Sum(P{[1..i]}) mod P[i]); # Muniru A Asiru, Mar 27 2018
CROSSREFS
Sequence in context: A256930 A226210 A194737 * A144090 A330674 A248966
KEYWORD
easy,nonn
AUTHOR
Randy L. Ekl, May 26 2002
EXTENSIONS
Edited by Robert G. Wilson v and Benoit Cloitre, May 30 2002
STATUS
approved