OFFSET
1,2
COMMENTS
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
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
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000 (corrected by Ray Chandler, Jan 19 2019)
FORMULA
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]
a(n) = Sum_{j=1..n-1} j*A001223(j+1). - Robert Israel, Mar 26 2015
EXAMPLE
a(4)=(11-3)+(11-5)+(11-7)=18.
MAPLE
N:= 1000: # to get terms for all odd primes <= N
P:= select(isprime, [seq(2*i+1, i=1..floor((N-1)/2))]):
Q:= ListTools[PartialSums](P):
seq(n*P[n]-Q[n], n=2..nops(P)); # Robert Israel, Mar 26 2015
MATHEMATICA
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}]
PROG
(PARI) A185382(n)=(n-1)*prime(n+1)-sum(k=2, n-1, prime(k)) \\ M. F. Hasler, May 02 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
Clark Kimberling, Feb 13 2012
EXTENSIONS
Edited and a(1)=0 prefixed by M. F. Hasler, May 02 2015
STATUS
approved