Ben Griswold on August 17th, 2010

In my attempt to learn Ruby out in the open, here’s my solution for Project Euler Problem 46.  I could be wrong, but I don’t see any exciting and new Ruby stuff going on here. The prime class continues to come in handy and I’m extending the integer class, but that’s about it. As always, any feedback [...]

Continue reading about Project Euler 46: Ruby

Ben Griswold on August 16th, 2010

In my attempt to learn Ruby out in the open, here’s my solution for Project Euler Problem 45.  After the last problem, I figure to heck with trying to optimize. Below you’ll find another brute force solution which completes in less than a second. The trick was finding the intersection of the three arrays which is a [...]

Continue reading about Project Euler 45: Ruby

Ben Griswold on August 16th, 2010

In my attempt to learn Ruby out in the open, here’s my solution for Project Euler Problem 44.  So much for my brute-force-only-just-get-the-answer-in-less-than-one-minute approach. I worked through this problem four different ways — each time holding x number of pentagonal numbers in a various data structure for quick comparison. That was a bad move as each attempt [...]

Continue reading about Project Euler 44: Ruby

Ben Griswold on August 15th, 2010

In my attempt to learn Ruby out in the open, here’s my solution for Project Euler Problem 43.  This is yet another problem where I blatantly avoided all real math. (Maybe that’s why it takes 37 seconds to execute…) I found this problem interesting, pun intended. Not much going on here, but I am starting to dig [...]

Continue reading about Project Euler 43: Ruby

Ben Griswold on August 15th, 2010

In my attempt to learn Ruby out in the open, here’s my solution for Project Euler Problem 42.  I don’t have much to say about this problem except for the fact that it holds strong ties to Euler 12 and Euler 22 so it doesn’t take long to piece this solution together. Minor note — you’ll notice [...]

Continue reading about Project Euler 42: Ruby

Ben Griswold on August 14th, 2010

In my attempt to learn Ruby out in the open, here’s my solution for Project Euler Problem 41.  I started off by iterating through all prime numbers up to the max value but it took way too long for the routine to complete. Instead I ended up gathering all possible pandigitals and I iterated through each descending. [...]

Continue reading about Project Euler 41: Ruby

Ben Griswold on August 14th, 2010

In my attempt to learn Ruby out in the open, here’s my solution for Project Euler Problem 40.  There’s nothing all that exciting going on here. I’m sure you noticed in past solutions that one can easily map a string to a range of characters. Perhaps the fact that Ruby can build a range of string values [...]

Continue reading about Project Euler 40: Ruby

Ben Griswold on August 14th, 2010

In my attempt to learn Ruby out in the open, here’s my solution for Project Euler Problem 39.  I broke my rule again and I worked through the problem a couple of different ways. In the first solution, I’m incrementing the number of occurrences using a hash and then I get the max count using (surprise) the [...]

Continue reading about Project Euler 39: Ruby