login
A355590
a(n) = (product of the first n primes) - (sum of the first n primes).
1
1, 0, 1, 20, 193, 2282, 29989, 510452, 9699613, 223092770, 6469693101, 200560489970, 7420738134613, 304250263526972, 13082761331669749, 614889782588491082, 32589158477190044349, 1922760350154212638630, 117288381359406970982769, 7858321551080267055878522
OFFSET
0,4
COMMENTS
The parity of a(n) is the opposite of the parity of n.
FORMULA
a(n) = A002110(n) - A007504(n).
EXAMPLE
a(4) = (2*3*5*7) - (2+3+5+7) = 193.
MATHEMATICA
FoldList[Times, 1, p = Prime[Range[20]]] - Prepend[Accumulate[p], 0] (* Amiram Eldar, Jul 08 2022 *)
PROG
(Python)
from itertools import count, islice
from sympy import nextprime
def agen():
p, s, primen = 1, 0, 0
while True:
yield p - s; primen = nextprime(primen); p *= primen; s += primen
print(list(islice(agen(), 20))) # Michael S. Branicky, Jul 08 2022
(PARI) a(n) = my(vp=primes(n)); vecprod(vp) - vecsum(vp); \\ Michel Marcus, Jul 08 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Des MacHale and Bernard Schott, Jul 08 2022
STATUS
approved