OFFSET
0,2
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..990 (terms n=1..100 from T. D. Noe)
EXAMPLE
The subsets of {1,2,3,4,5} that sum to a square are {}, {1}, {1,3}, {4}, {2,3,4}, {1,3,5} and {4,5}. Thus a(5)=7.
MAPLE
b:= proc(n, i) option remember; (m->
`if`(n=0 or n=m, 1, `if`(n<0 or n>m, 0, b(n, i-1)+
`if`(i>n, 0, b(n-i, i-1)))))(i*(i+1)/2)
end:
a:= proc(n) option remember; `if`(n<0, 0, a(n-1)+
add(b(j^2-n, n-1), j=isqrt(n)..isqrt(n*(n+1)/2)))
end:
seq(a(n), n=0..50); # Alois P. Heinz, Feb 02 2017
MATHEMATICA
g[n_] := Block[{p = Product[1 + z^i, {i, n}]}, Sum[Boole[IntegerQ[Sqrt[k]]]*Coefficient[p, z, k], {k, 0, n*(n + 1)/2}]]; Array[g, 35] (* Ray Chandler, Mar 05 2007 *)
PROG
(Haskell)
import Data.List (subsequences)
a126024 = length . filter ((== 1) . a010052 . sum) .
subsequences . enumFromTo 1
-- Reinhard Zumkeller, Feb 22 2012, Oct 27 2010
CROSSREFS
KEYWORD
nonn
AUTHOR
John W. Layman, Feb 27 2007
EXTENSIONS
Extended by Ray Chandler, Mar 05 2007
a(0)=1 prepended by Alois P. Heinz, Jan 30 2017
STATUS
approved