login
A350695
Number of solutions to +-2 +- 3 +- 5 +- 7 +- ... +- prime(n-1) = n.
2
1, 0, 1, 0, 1, 0, 1, 1, 4, 5, 9, 15, 26, 45, 77, 137, 243, 434, 774, 1408, 2554, 4667, 8627, 15927, 29559, 54867, 101688, 189425, 355315, 668598, 1264180, 2395462, 4506221, 8507311, 16084405, 30545142, 57898862, 110199367, 209957460, 400430494, 765333684
OFFSET
0,9
FORMULA
a(n) = [x^n] Product_{k=1..n-1} (x^prime(k) + 1/x^prime(k)).
MATHEMATICA
Table[SeriesCoefficient[Product[x^Prime[k] + 1/x^Prime[k], {k, n - 1}], {x, 0, n}], {n, 0, 40}] (* Stefano Spezia, Jan 30 2022 *)
PROG
(Python)
from sympy import sieve, primerange
from functools import cache
@cache
def b(n, i):
maxsum = 0 if i < 2 else sum(p for p in primerange(2, sieve[i-1]+1))
if n > maxsum: return 0
if i < 2: return 1
return b(n+sieve[i-1], i-1) + b(abs(n-sieve[i-1]), i-1)
def a(n): return b(n, n)
print([a(n) for n in range(41)]) # Michael S. Branicky, Jan 29 2022
KEYWORD
nonn
AUTHOR
Ilya Gutkovskiy, Jan 29 2022
STATUS
approved