cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

Original entry on oeis.org

1, 0, 1, 20, 193, 2282, 29989, 510452, 9699613, 223092770, 6469693101, 200560489970, 7420738134613, 304250263526972, 13082761331669749, 614889782588491082, 32589158477190044349, 1922760350154212638630, 117288381359406970982769, 7858321551080267055878522
Offset: 0

Views

Author

Des MacHale and Bernard Schott, Jul 08 2022

Keywords

Comments

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

Examples

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

Crossrefs

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
    

Formula

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