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.

A316706 Number of solutions to k_1 + 2*k_2 + ... + n*k_n = n, where k_i are from {-1,0,1}, i=1..n.

This page as a plain text file.
%I A316706 #23 Jul 09 2025 09:35:50
%S A316706 1,1,1,2,5,12,27,69,178,457,1194,3178,8538,23062,62726,171804,473069,
%T A316706 1308397,3634075,10133154,28352421,79575702,223981549,632101856,
%U A316706 1788172541,5069879063,14403962756,41001479103,116921037003,333971884899,955443681814,2737387314548,7853533625522,22560919253095,64890249175438,186854616134794
%N A316706 Number of solutions to k_1 + 2*k_2 + ... + n*k_n = n, where k_i are from {-1,0,1}, i=1..n.
%C A316706 a(n) is the coefficient of both x^n and 1/x^n in Product_{k=1..n} (1/x^k + 1 + x^k), while A007576 gives the constant term in the symmetric product.
%H A316706 Alois P. Heinz, <a href="/A316706/b316706.txt">Table of n, a(n) for n = 0..700</a> (first 501 terms from Vaclav Kotesovec)
%F A316706 a(n) = [x^n] Product_{k=1..n} (1/x^k + 1 + x^k).
%F A316706 a(n) = [x^(n*(n-1)/2)] Product_{k=1..n} (1 + x^k + x^(2*k)).
%F A316706 a(n) = [x^(n*(n+3)/2)] Product_{k=1..n} (1 + x^k + x^(2*k)).
%F A316706 a(n) ~ 3^(n + 1) / (2 * sqrt(Pi) * n^(3/2)). - _Vaclav Kotesovec_, Jul 11 2018
%t A316706 nmax = 40; p = 1; Flatten[{1, Table[Coefficient[p = Expand[p*(1/x^n + 1 + x^n)], x^n], {n, 1, nmax}]}] (* _Vaclav Kotesovec_, Jul 11 2018 *)
%o A316706 (PARI) {a(n) = polcoeff( prod(k=1,n, 1/x^k + 1 + x^k) + x*O(x^n),n)}
%o A316706 for(n=0,40, print1(a(n),", "))
%o A316706 (Python)
%o A316706 from collections import Counter
%o A316706 def A316706(n):
%o A316706     c = {0:1}
%o A316706     for k in range(1,n+1):
%o A316706         b = Counter(c)
%o A316706         for j in c:
%o A316706             a = c[j]
%o A316706             b[j+k] += a
%o A316706             b[j-k] += a
%o A316706         c = b
%o A316706     return c[n] # _Chai Wah Wu_, Feb 05 2024
%Y A316706 Cf. A007576, A059529.
%K A316706 nonn
%O A316706 0,4
%A A316706 _Paul D. Hanna_, Jul 10 2018