The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A331844 Number of compositions (ordered partitions) of n into distinct squares. 18

%I #15 Oct 29 2020 15:20:53

%S 1,1,0,0,1,2,0,0,0,1,2,0,0,2,6,0,1,2,0,0,2,6,0,0,0,3,8,0,0,8,30,0,0,0,

%T 2,6,1,2,6,24,2,8,6,0,0,8,30,0,0,7,32,24,2,8,30,120,6,24,2,6,0,8,36,

%U 24,1,34,150,0,2,12,30,24,0,2,38,150,0,12,78,144,2

%N Number of compositions (ordered partitions) of n into distinct squares.

%H Alois P. Heinz, <a href="/A331844/b331844.txt">Table of n, a(n) for n = 0..20000</a>

%H <a href="/index/Com#comp">Index entries for sequences related to compositions</a>

%H <a href="/index/Su#ssq">Index entries for sequences related to sums of squares</a>

%e a(14) = 6 because we have [9,4,1], [9,1,4], [4,9,1], [4,1,9], [1,9,4] and [1,4,9].

%p b:= proc(n, i, p) option remember;

%p `if`(i*(i+1)*(2*i+1)/6<n, 0, `if`(n=0, p!,

%p `if`(i^2>n, 0, b(n-i^2, i-1, p+1))+b(n, i-1, p)))

%p end:

%p a:= n-> b(n, isqrt(n), 0):

%p seq(a(n), n=0..82); # _Alois P. Heinz_, Jan 30 2020

%t b[n_, i_, p_] := b[n, i, p] = If[i(i+1)(2i+1)/6 < n, 0, If[n == 0, p!, If[i^2 > n, 0, b[n - i^2, i - 1, p + 1]] + b[n, i - 1, p]]];

%t a[n_] := b[n, Sqrt[n] // Floor, 0];

%t a /@ Range[0, 82] (* _Jean-François Alcover_, Oct 29 2020, after _Alois P. Heinz_ *)

%Y Cf. A000290, A006456, A032020, A032021, A032022, A033461, A218396, A219107, A331843, A331845, A331846, A331847.

%K nonn

%O 0,6

%A _Ilya Gutkovskiy_, Jan 29 2020

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 11 19:50 EDT 2024. Contains 373317 sequences. (Running on oeis4.)