in reply to Challenge: Number of unique ways to reach target sum

I've got this result from a quick-and-dirty script:

14479062752
(Update: this agrees with blokhead's and Limbic~Region's result.)

And here's the script itself. It's not perl but ruby.

ruby -we '@a = (0 .. 10).map { (0 .. 667).map { (0 .. 101).map { (); } +; }; }; def res c = 10, t = 667, m = 101; if t < 0; 0; else @a[c][t][ +m] ||= if 0 == c && 0 == t; 1; elsif 0 == c; 0; elsif 0 == t; 0; else + (1 ... m).inject(0) {|r, x| r + res(c - 1, t - x, x); } end; end; en +d; (1 .. 10).each {|c| res c; warn "[c=#{c}]"; }; p res;'

Update: It turns out that the statement I put in there as a progress indicator does very much redundant calculations, so removing it makes the code twice as fast:

ruby -we '@a = (0 .. 10).map { (0 .. 667).map { (0 .. 101).map { (); +}; }; }; def res c = 10, t = 667, m = 101; if t < 0; 0; else @a[c][t] +[m] ||= if 0 == c && 0 == t; 1; elsif 0 == c; 0; elsif 0 == t; 0; els +e (1 ... m).inject(0) {|r, x| r + res(c - 1, t - x, x); } end; end; e +nd; p res;' 14479062752