Problem 125 of Project Euler deals with a property we have worked with before, palindromic numbers. The problem readsFind the sum of all the numbers less than 108 that are both palindromic and can be written as the sum of consecutive squares.I don't think there is a way we can avoid checking a whole lot of numbers. However, we can either generate all palindromic numbers and check if them are sum of squares. Or we can go the other way and generate all sum of squares and check if they are palindromes. I took the latter approach since we already have an efficient solution for check if a number is palindromic.

Continue reading...Saturday, August 6, 2011

Problem 55 of Project Euler has a rather long description, the gist of it beingA number that never forms a palindrome through the reverse and add process is called a Lychrel number. How many Lychrel numbers are there below ten-thousand? So the question gives us bounds for the search space. We need to search numbers less than 10.000 and we need to make a maximum of 50 iterations. Since we already have a method to reverse a number and check if it is palindromic, it should be pretty straight forward to create a brute force solution. Besides the brute force solution I will present a method with cache such that we don't need to search the same number multiple times.

Continue reading...Saturday, April 16, 2011

In Problem 36 of Project Euler we are revisiting palindromic numbers. This time with we need to find numbers which are not only palindromic in base 10 but also in base two, meaning in a binary representation. The problem description reads**Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.**I will take 3 approaches in this post. First I will do like in the solution to problem 4 by making string manipulation to reverse the number and compare it to the original number in both base 2 and 10. The second step I will build a function which can reverse an integer in any base without converting it to a string. The last step will be to generate palindromic numbers, so we only have to check if a number is palindromic in the other base.

Saturday, October 16, 2010

The problem in question 4 is a bit different from other problems we have encountered. It goesFind the largest palindrome made from the product of two 3-digit numbers.For this I can see two different approaches, but I will only discuss one of them.

Continue reading...This site uses cookies.

Saturday, December 1, 2012

2 Comments