Sunday, June 27th, 2010

Project Euler Problems #15, #16, #17

Problem #15 Starting in the top left corner in a 20 by 20 grid, how many routes are there to the bottom right corner? I often used this question during interviews and suprisingly, very few candidates were able to make much progress with it. I wasn’t looking for a candidate to code it 100% correctly […]

Saturday, April 10th, 2010

Project Euler Problems #12, #13, #14

Problem #12 Find the first triangle number to have over 500 divisors. As I’m progressing through these problems, certain types/sequences of numbers keep popping up. I’ve started a library of functions called The first thing I did was add a triangle number generator to my library: def triangleNumber(): num = 1 add = 2 […]

Friday, February 5th, 2010

Project Euler Problems #9, #10, #11

It’s time to get back to discovering how much math and python I’ve forgotten… Problem #9 Find the only Pythagorean triplet (a,b,c where a < b < c and a^2 + b^2 = c^2) where a + b + c = 1000. The first thing I decided to do was figure out some bounds based […]

Wednesday, October 7th, 2009

Project Euler Problems #6, #7, #8

I took a break from projecteuler to whip up a webOS application before my Tahoe Rim Trail Thru-hike. Upon returning I started skiming some technical books and started playing around with the Facebook Puzzles. In general, starting lots of threads is exciting and gives me the feeling that I am learning a lot; however, I […]

Thursday, July 16th, 2009

Project Euler Problems #3 and #5

I got ahead of myself last post and skipped problem 3. Maybe it’s because it wasn’t that interesting: what’s the largest prime factor of 600851475143? Being an odd number meant 2 was not the largest prime factor, and no even numbers are prime so this simple trial division function seemed to work pretty well: def […]

Sunday, July 12th, 2009

Project Euler Problem #4

As I work through these projecteuler problems, it’s become apparent that my brain tends towards a particular style of solution. When I know one way to solve a problem, I tend to just implement it, as I want to get to the next one. In the future, I’m going to start trying to find multiple […]

Monday, July 6th, 2009

Project Euler Problem #2

Problem 2 from projecteuler requested the sum of all the even Fibonacci numbers below 4 million. I had seen references to “generators” in some of the Python howtos and after further reading, this seemed like a reasonable place to try them out. def fibGenerator(): fib0 = 0 fib1 = 1 while True: yield fib1 fibNext […]