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.

A338398 Inverse boustrophedon transform of the primes.

Original entry on oeis.org

2, 1, 1, -3, -1, -29, 33, -315, 1251, -7905, 48667, -344723, 2623549, -21739937, 193680399, -1849767375, 18840708855, -203907377005, 2336594492591, -28262970918841, 359855118160333, -4810909461068941, 67379837645787507, -986592769520379701
Offset: 0

Views

Author

Pontus von Brömssen, Oct 24 2020

Keywords

Crossrefs

Programs

  • Python
    import sympy
    def A338398(n):
      T=[]
      for k in range(n+1):
        T.append(sympy.prime(k+1))
        T.reverse()
        for i in range(k):
          T[i+1]=T[i]-T[i+1]
      return T[-1]
    
  • Python
    from itertools import accumulate, islice, count
    from operator import sub
    from sympy import prime
    def A338398_gen(): # generator of terms
        blist = tuple()
        for i in count(1):
            yield (blist := tuple(accumulate(reversed(blist),func=sub,initial=prime(i))))[-1]
    A338398_list = list(islice(A338398_gen(),20)) # Chai Wah Wu, Jun 10 2022

Formula

a(n) = Sum_{k=0..n} (-1)^(n-k) * binomial(n,k) * A000111(n-k) * A000040(k+1).