I got a fun little question from Jean-Marie by email the other day. With the disclaimer that I don’t really have the time to solve that many puzzles and therefore probably wont be able to give you a solution to puzzles like this one. This one triggered my curiosity and I managed to find a [...]
Continue reading...
Saturday, July 7, 2012
Problem 104 of Project Euler is squeezed in between three related problems, but that should not keep us from actually solving it. The problem reads Given that Fk is the first Fibonacci number for which the first nine digits AND the last nine digits are 1-9 pandigital, find k. It is pretty obvious to me that there is a brute force approach which requires almost no brainpower to implement, so I went for that one first to see if that would do the trick.
Continue reading...Tuesday, May 17, 2011
When I first saw pandigital numbers I thought it was just a curious thing that we would visit once. I was wrong as Problem 42 of Project Euler is also about a special group of pandigital numbers. The problem readsFind the sum of all pandigital numbers with an unusual sub-string divisibility propertyWe will take two different approaches to this. First We will explore the brute force of generating all permutations and after that we will use the divisibility requirements to limit the number of permutations we have to explore.
Continue reading...Tuesday, May 10, 2011
This time we mix two old topics together and form a new question. This time Project Euler has mixed pandigital numbers and primes and Problem 41 asks us to find the largest such number. The problem description reads What is the largest n-digit pandigital prime that exists?I will start solving it by brute force and as we shall see the approach is possible but very inefficient, so after that I will show you how to speed the process up by using a small property of numbers that I was taught in 4th grade or so - And no, I am not particularly gifted, the trick is just really simple.
Continue reading...Saturday, April 30, 2011
Pandigital numbers were the topic of Problem 32 and here in Problem 38 of Project Euler we visit them again. The problem reads What is the largest 1 to 9 pandigital 9-digit number that can be formed as the concatenated product of an integer with (1,2, ... , n) where n > 1?As we shall see the problem is pretty easy to solve once we do a bit of analysis. Doing the analysis will give us a really simple piece of code which needs to check only a few numbers.
Continue reading...Saturday, March 19, 2011
Problem 32 of Project Euler is about a special kind of number - Pandigital numbers. Something I haven't heard about before, but they are very much used in commercials as phone and credit card numbers. The problem reads Find the sum of all products whose multiplicand/multiplier/product identity can be written as a 1 through 9 pandigital.I have only found one way to solve the problem the brute force methods, though there are a lot of choices for trimming the search spaces, and there is some code fiddling to code an efficient way for checking if a given number is pandigital. I will give you a solution in two parts, first we will look into checking if a number is pandigital, and later we will minimize the number of numbers we need to check in order to find all the pandigital number we are looking for.
Continue reading...
Thursday, September 6, 2012
3 Comments