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”).

a(n) = (product of the first n primes) - (sum of the first n primes).
1

%I #20 Jul 11 2022 16:10:53

%S 1,0,1,20,193,2282,29989,510452,9699613,223092770,6469693101,

%T 200560489970,7420738134613,304250263526972,13082761331669749,

%U 614889782588491082,32589158477190044349,1922760350154212638630,117288381359406970982769,7858321551080267055878522

%N a(n) = (product of the first n primes) - (sum of the first n primes).

%C The parity of a(n) is the opposite of the parity of n.

%F a(n) = A002110(n) - A007504(n).

%e a(4) = (2*3*5*7) - (2+3+5+7) = 193.

%t FoldList[Times, 1, p = Prime[Range[20]]] - Prepend[Accumulate[p], 0] (* _Amiram Eldar_, Jul 08 2022 *)

%o (Python)

%o from itertools import count, islice

%o from sympy import nextprime

%o def agen():

%o p, s, primen = 1, 0, 0

%o while True:

%o yield p - s; primen = nextprime(primen); p *= primen; s += primen

%o print(list(islice(agen(), 20))) # _Michael S. Branicky_, Jul 08 2022

%o (PARI) a(n) = my(vp=primes(n)); vecprod(vp) - vecsum(vp); \\ _Michel Marcus_, Jul 08 2022

%Y Cf. A000040, A002110, A007504, A059841.

%K nonn

%O 0,4

%A _Des MacHale_ and _Bernard Schott_, Jul 08 2022