Movies: Enchanted | Main | Y: The Last Man
March 20, 2008
Project Euler update
Made it into the Top 1000 after yesterday and problems remain interesting.
Couple of ones lately I found interesting were #79 with just how easy it was - did in less than 5 minutes by hand and #58. On this one, it first took me a while to realize the magnitude of the numbers one is dealing with before one gets to the result. Realizing this, I had to shift my approach but I didn't want to individually test for primality an insane number of numbers (mostly for primes I have just been reading in a list of them from a file but it only goes up to like 20 million and here one needs to go way beyond that). I first tried to do a Sieve of Eratosthenes but my computer couldn't handle the memory requirements of a 300+ million element array in Perl. Doing this in C++ with Booleans probably would have solved this but decided not to go that route. I finally ended up using a hybrid approach that was acceptably fast. Read in my primes list file and for numbers under 2 million check against it and then for bigger numbers (by which point one is only needing to test 1 in 1000+ numbers) individually check them.
Posted by aarondf at March 20, 2008 03:50 PM
Comments
Post a comment
Thanks for signing in, . Now you can comment. (sign out)
(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)