A357354 Number of partitions of n into distinct positive squares such that the number of parts is a square.
1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 3, 1, 0, 2, 0, 0, 1, 1, 1
Offset: 0
Examples
a(30) = 1 because we have [16,9,4,1]. a(78) = 3: [36,25,16,1], [49,16,9,4], [64,9,4,1].
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..20000
Programs
-
Maple
b:= proc(n, i, t) option remember; `if`(n=0, `if`(issqr(t), 1, 0), `if`(n>i*(i+1)*(2*i+1)/6, 0, `if`(i^2>n, 0, b(n-i^2, i-1, t+1))+b(n, i-1, t))) end: a:= n-> b(n, isqrt(n), 0): seq(a(n), n=0..100); # Alois P. Heinz, Sep 25 2022
-
Mathematica
b[n_, i_, t_] := b[n, i, t] = If[n == 0, If[IntegerQ @ Sqrt[t], 1, 0], If[n > i*(i+1)*(2*i+1)/6, 0, If[i^2 > n, 0, b[n-i^2, i-1, t+1]] + b[n, i-1, t]]]; a[n_] := b[n, Floor @ Sqrt[n], 0]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Apr 24 2025, after Alois P. Heinz *)