login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A338398
Inverse boustrophedon transform of the primes.
1
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,1
FORMULA
a(n) = Sum_{k=0..n} (-1)^(n-k) * binomial(n,k) * A000111(n-k) * A000040(k+1).
PROG
(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
CROSSREFS
KEYWORD
sign
AUTHOR
STATUS
approved