OFFSET
0,1
LINKS
Eric Weisstein's World of Mathematics, Boustrophedon Transform
Wikipedia, Boustrophedon transform
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]
CROSSREFS
KEYWORD
sign
AUTHOR
Pontus von Brömssen, Oct 24 2020
STATUS
approved