A355590 a(n) = (product of the first n primes) - (sum of the first n primes).
1, 0, 1, 20, 193, 2282, 29989, 510452, 9699613, 223092770, 6469693101, 200560489970, 7420738134613, 304250263526972, 13082761331669749, 614889782588491082, 32589158477190044349, 1922760350154212638630, 117288381359406970982769, 7858321551080267055878522
Offset: 0
Keywords
Examples
a(4) = (2*3*5*7) - (2+3+5+7) = 193.
Programs
-
Mathematica
FoldList[Times, 1, p = Prime[Range[20]]] - Prepend[Accumulate[p], 0] (* Amiram Eldar, Jul 08 2022 *)
-
PARI
a(n) = my(vp=primes(n)); vecprod(vp) - vecsum(vp); \\ Michel Marcus, Jul 08 2022
-
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
Comments