in reply to RFC: Integer::Partition::Unrestricted

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
perl -ple'$_=reverse' <<<ti.xittelop@oivalf

Don't fool yourself.
  • Comment on Re: RFC: Integer::Partition::Unrestricted

Replies are listed 'Best First'.
Re^2: RFC: Integer::Partition::Unrestricted
by Limbic~Region (Chancellor) on Feb 24, 2007 at 15:14 UTC
    frodo72,
    Thanks for the feedback. I lost interest in Project Euler a long time ago. Since my intent, as noted in the forum of problem 78, was to write code reusable for others - I ignored optimizations specific to the problem posed. I have not given up on the idea of publishing it but it needs to be part of a larger puzzle and right now I don't have time for that.

    Cheers - L~R