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”).
%I #44 Sep 19 2019 09:51:06
%S 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,
%T 87,63,11,69,17,70,42,41,11,72,139,75,146,44,8,9,164,88,48,7,201,121,
%U 79,224,92,46,57,170,26,145,95,216,112,58,71,293,185,129,13,255,81,128
%N Remainder when sum of first n primes is divided by n-th prime.
%C Conjecture: Every nonnegative integer can appear in the sequence at most finitely many times. - _Thomas Ordowski_, Jul 22 2013
%C I conjecture the opposite. Heuristically a given number should appear log log x times below x. - _Charles R Greathouse IV_, Jul 22 2013
%C 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
%C Yes, it happens for n = 83408, too. - _Michel Marcus_, Mar 27 2018
%H T. D. Noe, <a href="/A071089/b071089.txt">Table of n, a(n) for n = 1..10000</a>
%F 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]).
%F a(A024011(n)) = 0. - _Michel Marcus_, Jan 22 2015
%e 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.
%p s:= proc(n) option remember; `if`(n=0, 0, ithprime(n)+s(n-1)) end:
%p a:= n-> irem(s(n), ithprime(n)):
%p seq(a(n), n=1..100); # _Alois P. Heinz_, Mar 27 2018
%t f[n_] := Mod[ Sum[ Prime[i], {i, 1, n - 1}], Prime[n]]; Table[ f[n], {n, 1, 70}] or
%t 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}]
%t f[n_] := Mod[Plus @@ Prime@ Range@ n, Prime@ n]; Array[f, 70] (* _Robert G. Wilson v_, Nov 12 2016 *)
%t Module[{nn=70,t},t=Accumulate[Prime[Range[nn]]];Mod[#[[1]],#[[2]]]&/@ Thread[ {t,Prime[Range[nn]]}]] (* _Harvey P. Dale_, Sep 19 2019 *)
%o (PARI) for(n=1,100,s=sum(i=1,n, prime(i)); print1(s-prime(n)*floor(s/prime(n)),","))
%o (PARI) a(n) = vecsum(primes(n)) % prime(n); \\ _Michel Marcus_, Mar 27 2018
%o (GAP) P:=Filtered([1..1000],IsPrime);
%o a:=List([1..70],i->Sum(P{[1..i]}) mod P[i]); # _Muniru A Asiru_, Mar 27 2018
%Y Cf. A007506, A024011.
%K easy,nonn
%O 1,2
%A _Randy L. Ekl_, May 26 2002
%E Edited by _Robert G. Wilson v_ and _Benoit Cloitre_, May 30 2002