Solved the first problem at projecteuler dot net