login
Number of ways of writing n as a sum of powers of 6, each power being used at most six times.
2

%I #19 Oct 19 2019 10:15:32

%S 1,1,1,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,2,1,1,1,

%T 1,1,3,2,2,2,2,2,3,1,1,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,2,1,

%U 1,1,1,1,3,2,2,2,2,2,3,1,1,1,1,1,2,1,1,1,1,1,2

%N Number of ways of writing n as a sum of powers of 6, each power being used at most six times.

%H Seiichi Manyama, <a href="/A303824/b303824.txt">Table of n, a(n) for n = 0..10000</a>

%F G.f.: Product_{k>=0} (1-x^(7*6^k))/(1-x^(6^k)).

%F a(0)=1; for k>0, a(6*k) = a(k)+a(k-1) and a(6*k+r) = a(k) with r=1,2,3,4,5.

%F G.f. A(x) satisfies: A(x) = (1 + x + x^2 + x^3 + x^4 + x^5 + x^6) * A(x^6). - _Ilya Gutkovskiy_, Jul 09 2019

%p b:= proc(n, i) option remember; `if`(n=0, 1, `if`(i<0, 0,

%p add(b(n-j*6^i, i-1), j=0..min(6, n/6^i))))

%p end:

%p a:= n-> b(n, ilog[6](n)):

%p seq(a(n), n=0..120); # _Alois P. Heinz_, May 01 2018

%t m = 100; A[_] = 1;

%t Do[A[x_] = Total[x^Range[0, 6]] A[x^6] + O[x]^m // Normal, {m}];

%t CoefficientList[A[x], x] (* _Jean-François Alcover_, Oct 19 2019 *)

%o (Ruby)

%o def A(k, n)

%o ary = [1]

%o (1..n).each{|i|

%o s = ary[i / k]

%o s += ary[i / k - 1] if i % k == 0

%o ary << s

%o }

%o ary

%o end

%o p A(6, 100)

%Y Number of ways of writing n as a sum of powers of b, each power being used at most b times: A054390 (b=3), A277872 (b=4), A277873 (b=5), this sequence (b=6), A303825 (b=7).

%K nonn

%O 0,7

%A _Seiichi Manyama_, May 01 2018