My modified code. Blockhead's used memo for counting but not for generation. I suspect that without memoize blokhead's code would take hours or days.
So we're comparing apples to oranges which is perfectly legitimate if you want to find out whether apples are faster than oranges :).
As far as I can tell my Perl is faster than your C. So (for a sanity check) if you run blokhead's memoized counting code on your machine (the machine that takes 72 mins for the C) how long does it take?
In reply to Re^9: Challenge: Number of unique ways to reach target sum
by fergal
in thread Challenge: Number of unique ways to reach target sum
by Limbic~Region
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |