#Pyth, 34 33 31 29
Pyth, 34 33 31 29
Basically a translation of xnor's Python answer. I'm still not great with Pyth, so improvement suggestions are welcome.
Defines a function y to return a list of lists of integers.
L?]]1<b2smm++*kdb*k_dy-b1,1_1 Update: Saved 2 bytes thanks to FryAmTheEggman.
Explanation:
L define a function y with argument b that returns ?*]]1<b2 [[1]] if b < 2 else s sum( m map(lambda d: m map(lambda k: ++*kdb*k_d k*d + [b] + k*-d y-b1 , y(b - 1)) ,1_1) , (1, -1))