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.

A348639 Number of ways to express n in the form 1 +- 2 +- 3 ... +- n.

This page as a plain text file.
%I A348639 #20 Dec 24 2024 22:12:00
%S A348639 1,0,0,1,2,0,0,6,11,0,0,57,103,0,0,615,1131,0,0,7209,13467,0,0,89261,
%T A348639 168515,0,0,1147893,2183943,0,0,15181540,29055149,0,0,205171534,
%U A348639 394497990,0,0,2820847321,5444272739,0,0,39329485312,76142226498,0,0,554756557011
%N A348639 Number of ways to express n in the form 1 +- 2 +- 3 ... +- n.
%C A348639 a(n) is the coefficient of x^(n*(n+3)/4-1) of Product_{k=2..n} (1+x^k). - _Jianing Song_, Nov 19 2021
%H A348639 Jianing Song, <a href="/A348639/b348639.txt">Table of n, a(n) for n = 1..1000</a>
%o A348639 (C)
%o A348639 int solsN(int n, int k, int sum) { if (n == k) return sum == n; return solsN(n, k+1, sum + k + 1) + solsN(n, k+1, sum - k - 1);}
%o A348639 int getNumber(int n) { return solsN(n, 1, 1); }
%o A348639 (Python)
%o A348639 from functools import cache
%o A348639 @cache
%o A348639 def b(t, s, u): # target, sum, upto
%o A348639     if u == 1: return int(t == s + 1)
%o A348639     return b(t, s - u, u - 1) + b(t, s + u, u - 1)
%o A348639 def a(n): return b(n, 0, n)
%o A348639 print([a(n) for n in range(1, 49)]) # _Michael S. Branicky_, Oct 29 2021
%o A348639 (PARI) list(n) = my(poly=vector(n), v=vector(n)); poly[1]=1; for(k=2, n, poly[k]=poly[k-1]*(1+'x^k)); for(k=1, n, if(k%4==2||k%4==3, v[k]=0, v[k]=polcoeff(poly[k], k*(k+3)/4-1))); v \\ _Jianing Song_, Nov 19 2021
%Y A348639 Cf. A000980, A058377.
%K A348639 nonn
%O A348639 1,5
%A A348639 _Daniel Cortild_, Oct 26 2021
%E A348639 a(30)-a(48) from _Michael S. Branicky_, Oct 29 2021