XP is just a number | |
PerlMonks |
Re^2: Triangle Numbers Revisitedby Limbic~Region (Chancellor) |
on Oct 14, 2004 at 12:53 UTC ( [id://399187]=note: print w/replies, xml ) | Need Help?? |
TedPride,
Good catch! I didn't have time to track it down myself this morning as I was supposed to be getting ready for work. For the purposes of the original thread, it appears that 0 was being allowed as a triangular number. With that allowance, all numbers can indeed be the sum of 3 triangles.
As far as speed, you are right that this is quite fast. If it was not fast enough in a real problem you would likely use C as tachyon, the cheater, did ;-)
Cheers - L~R
In Section
Seekers of Perl Wisdom
|
|