login
a(n) = sum of the remainders when the n-th prime is divided by primes up to the (n-1)-th prime.
12

%I #32 May 05 2024 08:55:20

%S 0,1,3,4,8,13,18,27,29,46,56,70,74,88,98,134,147,171,200,217,252,274,

%T 309,323,348,418,448,471,522,571,629,685,739,777,793,853,954,997,1002,

%U 1120,1148,1220,1338,1419,1466,1540,1615,1573,1633,1707,1825,1892,1986

%N a(n) = sum of the remainders when the n-th prime is divided by primes up to the (n-1)-th prime.

%C Row sums of A207409. - _Bob Selcoe_, Apr 14 2014

%H Robert Israel, <a href="/A033955/b033955.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = Sum_{k=1..n-1} ( prime(n) mod prime(k) ).

%e a(5) = 8. The remainders when the fifth prime 11 is divided by 2, 3, 5, 7 are 1, 2, 1, 4, respectively and their sum = 8.

%p P:= [seq(ithprime(i),i=1..200)]:

%p f:= proc(n) local j; add(P[n] mod P[j],j=1..n-1) end proc:

%p map(f, [$1..200]); # _Robert Israel_, Dec 29 2020

%t a[n_] := Sum[Mod[Prime[n], Prime[i]], {i, 1, n-1}]

%t Table[Total[Mod[Prime[n],Prime[Range[n-1]]]],{n,60}] (* _Harvey P. Dale_, Mar 07 2018 *)

%o (PARI) {for(n=1, 200, print1(sum(k=1, n, prime(n)%prime(k)), ", "))}

%o (Python) from sympy import prime; {print(sum(prime(n)%prime(k) for k in range(1,n)), end =', ') for n in range(1,54)} # _Ya-Ping Lu_, May 05 2024

%Y Cf. A067435, A067436, A024934, A207409.

%K nonn,easy

%O 1,3

%A Armand Turpel (armandt(AT)unforgettable.com)

%E Edited by _Dean Hickerson_, Mar 02 2002