A338398 Inverse boustrophedon transform of the primes.
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
Keywords
Links
- Eric Weisstein's World of Mathematics, Boustrophedon Transform
- Wikipedia, Boustrophedon transform
- Index entries for sequences related to boustrophedon transform
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