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.

A350695 Number of solutions to +-2 +- 3 +- 5 +- 7 +- ... +- prime(n-1) = n.

This page as a plain text file.
%I A350695 #40 Jan 30 2022 15:58:34
%S A350695 1,0,1,0,1,0,1,1,4,5,9,15,26,45,77,137,243,434,774,1408,2554,4667,
%T A350695 8627,15927,29559,54867,101688,189425,355315,668598,1264180,2395462,
%U A350695 4506221,8507311,16084405,30545142,57898862,110199367,209957460,400430494,765333684
%N A350695 Number of solutions to +-2 +- 3 +- 5 +- 7 +- ... +- prime(n-1) = n.
%F A350695 a(n) = [x^n] Product_{k=1..n-1} (x^prime(k) + 1/x^prime(k)).
%t A350695 Table[SeriesCoefficient[Product[x^Prime[k] + 1/x^Prime[k], {k, n - 1}], {x, 0, n}], {n, 0, 40}] (* _Stefano Spezia_, Jan 30 2022 *)
%o A350695 (Python)
%o A350695 from sympy import sieve, primerange
%o A350695 from functools import cache
%o A350695 @cache
%o A350695 def b(n, i):
%o A350695     maxsum = 0 if i < 2 else sum(p for p in primerange(2, sieve[i-1]+1))
%o A350695     if n > maxsum: return 0
%o A350695     if i < 2: return 1
%o A350695     return b(n+sieve[i-1], i-1) + b(abs(n-sieve[i-1]), i-1)
%o A350695 def a(n): return b(n, n)
%o A350695 print([a(n) for n in range(41)]) # _Michael S. Branicky_, Jan 29 2022
%Y A350695 Cf. A000040, A022894, A058377, A063890, A113040, A261061, A350404.
%K A350695 nonn
%O A350695 0,9
%A A350695 _Ilya Gutkovskiy_, Jan 29 2022