"be consistent" | |
PerlMonks |
Re: RFC: Integer::Partition::Unrestrictedby polettix (Vicar) |
on Feb 24, 2007 at 14:46 UTC ( [id://601876]=note: print w/replies, xml ) | Need Help?? |
I think you probably don't go and look for feedback for problem 78 on Project Euler, so I decided to give you one here :)
Your generator is quite impressive but it is a bit overkill in this case. The problem statement requires divisibility by 1_000_000, which means that you can do all sums and differences modulo 1_000_000 and still get a good answer; moreover, you can cache values of p(n) modulo 1_000_000. As a consequence, you can work with "regular" integers and get rid of bigint, which slows you down. In my solution, I am a bit less optimised than you, because I'm calculating pentas all the time; in any case, it runs in about 19 seconds on Centrino 1.6GHz. If you're interested, I've put it into Project Euler forum entry #78 (I'm polettix). I also saw that you didn't publish this code, but I think it could be useful - who knows? :) Flavio
In Section
Meditations
|
|