After over a week, I have finally come up with a solution to Project Euler #3. In which I was asked to find the largest prime factor of the number 600851475143. This was a particularly nasty little bugger that gave me all sorts of hell. It took me a while in the first place to come up with an algorithm to figure primes. I thought I was sitting pretty when I got that working, but the number they give was too big to compute with brute force, so I had to come up with a way to chop it down a bit. The solution, as you can see, is pretty messy, and I barely have a grasp on how it even works. The print out is also really quite gross, so you have to know what you're even looking for, but it works. I've got my answer. I can sleep through my nights once more.
I've also managed to plow through another problem involving Primes that I had passed over, Problem 7, which by comparison seemed pretty meager simply asking me to find the 10001st Prime. No problem. Just takes a while to compute.
Archives
- January 2010 (2)
- November 2009 (1)
- October 2009 (4)
- September 2009 (2)
- August 2009 (4)
- July 2009 (15)
- June 2009 (21)
- May 2009 (8)
- April 2009 (6)
- March 2009 (11)
- February 2009 (6)
- January 2009 (9)
- December 2008 (2)
- November 2008 (1)
- October 2008 (2)
- September 2008 (12)
- August 2008 (8)
- July 2008 (5)
- June 2008 (4)
- May 2008 (15)
- April 2008 (2)
- February 2008 (1)
- January 2008 (1)
- December 2007 (2)
- November 2007 (2)
- October 2007 (4)
- September 2007 (3)
- August 2007 (3)
- July 2007 (6)
- June 2007 (2)
- May 2007 (5)
- April 2007 (2)
- March 2007 (4)
No comments:
Post a Comment