login
Sum_{j=1..n-1} P(n)-P(j), where P(j) = A065091(j) is the j-th odd prime.
5

%I #57 Jan 19 2019 15:31:32

%S 0,2,6,18,26,46,58,86,134,152,212,256,280,332,416,506,538,640,712,750,

%T 870,954,1086,1270,1366,1416,1520,1574,1686,2092,2212,2398,2462,2792,

%U 2860,3070,3286,3434,3662,3896,3976,4386,4470,4642,4730,5270

%N Sum_{j=1..n-1} P(n)-P(j), where P(j) = A065091(j) is the j-th odd prime.

%C It appears 1/3 of a(n) values are divisible by 3 (as measured up to n = 8000). Almost all of these cases occur consecutively (i.e., in "runs"). The sizes of these runs, including runs of 1, in the first 250 primes are given by this sequence: {2, 4, 1, 1, 2, 4, 2, 2, 3, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, 5, 6, 3, 2, 2, 3, 3, 9, 1, ..} with two runs up to 12 in length occurring in the first 5000 primes. - _Richard R. Forberg_, Mar 26 2015

%C a(n+1) == a(n) (mod 3) iff n == 0 (mod 3) or P(n+1) == P(n) (mod 3); this should have asymptotic probability 2/3, and explains some of the above comment. - _Robert Israel_, Mar 26 2015

%H Robert Israel, <a href="/A185382/b185382.txt">Table of n, a(n) for n = 1..10000</a> (corrected by Ray Chandler, Jan 19 2019)

%F a(n) = (n-1)*A065091(n) - A071148(n-1) = (n-1)*prime(n+1) - sum_{1 < k <= n} prime(k). [Corrected and extended by _M. F. Hasler_, May 02 2015]

%F a(n) = A206803(n) - A206803(n-1).

%F a(n) = Sum_{j=1..n-1} j*A001223(j+1). - _Robert Israel_, Mar 26 2015

%e a(4)=(11-3)+(11-5)+(11-7)=18.

%p N:= 1000: # to get terms for all odd primes <= N

%p P:= select(isprime,[seq(2*i+1, i=1..floor((N-1)/2))]):

%p Q:= ListTools[PartialSums](P):

%p seq(n*P[n]-Q[n],n=2..nops(P)); # _Robert Israel_, Mar 26 2015

%t s[k_] := Prime[k + 1]; p[n_] := Sum[s[k], {k, 1, n}]; c[n_] := n*s[n] - p[n]; Table[c[n], {n, 2, 100}]

%o (PARI) A185382(n)=(n-1)*prime(n+1)-sum(k=2,n-1,prime(k)) \\ _M. F. Hasler_, May 02 2015

%Y Cf. A001223, A152535, A206802 (a(n)/2), A206803 (= partial sums of this), A206804, A206817.

%K nonn

%O 1,2

%A _Clark Kimberling_, Feb 13 2012

%E Edited and a(1)=0 prefixed by _M. F. Hasler_, May 02 2015