OFFSET
0,4
COMMENTS
The parity of a(n) is the opposite of the parity of 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