# Pandigital numbers (squares)

• December 25th 2009, 06:34 AM
Dr. Jekyll
Pandigital numbers (squares)
Hello everybody!

I need a little help with my homework. I need to find all (natural) numbers whose squares are pandigital numbers (they use each of the digits 0,1,...,9 only once), e.g. $71433^2=5102673489$.

Since that would take ages to do manually, I made a small program in Mathematica which finds all such numbers. Now, I would like to know if there is some "more mathematical" way to do this or is it simply the work for computers.

P.S. Sorry for eventually bad English. It's not my native language.
• December 25th 2009, 10:36 AM
Wilmer
Can only think of the search program being restricted to
ceiling[sqrt(1023456789)] = 31992 and floor[sqrt(9876543210)] = 99380;
so a looper:
loop n from 31992 to 99380
x = n^2
x's digits all different?
• December 25th 2009, 11:49 AM
Soroban
Hello, Dr. Jekyll!

Quote:

I need to find all (natural) numbers whose squares are pandigital numbers
(they use each of the digits 0,1,...,9 only once), e.g. $71433^2=5102673489$.

Since that would take ages to do manually, I made a small program
in Mathematica which finds all such numbers.
Now, I would like to know if there is some "more mathematical" way to do this.

I don't know of any algorithm that will help.

I did find a list of pandigital squares
. . with your example conspicuously missing.

. . $\begin{array}{ccc} 32043^2 \:=\:1026753849 & & 45624^2 \:=\:2081549376 \\
32286^2 \:=\:1042385796 & & 55446^2 \:=\:3074258916 \\
33144^2 \:=\:1098524736 && 68763^2 \:=\:4728350169 \\
35172^2 \:=\:1237069584 && 83919^2 \:=\:7042398561 \\
39147^2 \:=\:1532487609 && 99066^2 \:=\:9814072356\end{array}$

• December 25th 2009, 05:08 PM
Dr. Jekyll
Quote:

Originally Posted by Wilmer
Can only think of the search program being restricted to
ceiling[sqrt(1023456789)] = 31992 and floor[sqrt(9876543210)] = 99380;
so a looper:
loop n from 31992 to 99380
x = n^2
x's digits all different?

Well, that's exactly what I did. I'm allowed to use Mathematica (or Maple) for my homework and since Mathematica has function which counts digits I managed to find all such numbers. I also wrote a program in C which does the same thing and I think it found 87 such numbers or something like that. They all seemed correct. Maybe I'll post these numbers later.
• December 25th 2009, 05:53 PM
Wilmer
87 is correct.

Wonder where Soroban got only 10...
• December 26th 2009, 02:36 PM
awkward
I don't know of a pencil-and-paper solution, but you can reduce the search space somewhat by observing that if x is a pandigital number then x must be divisible by 3. That is because the sum of the digits of x^2 is 0+1+2+...+9 = 45, which is divisible by 9, so x^2 is divisible by 9.

If you consider the problem where x^2 has digits 1,2,...,9 (excluding zero), there are fewer solutions, and I think I once found a reference showing that all the solutions had been found in the pre-computer era, so a pencil and paper solution must exist. But I have never seen it (or found it, despite trying). :-(
• December 26th 2009, 05:54 PM
HallsofIvy
Quote:

Originally Posted by Dr. Jekyll
Hello everybody!

I need a little help with my homework. I need to find all (natural) numbers whose squares are pandigital numbers (they use each of the digits 0,1,...,9 only once), e.g. $71433^2=5102673489$.

Since that would take ages to do manually, I made a small program in Mathematica which finds all such numbers. Now, I would like to know if there is some "more mathematical" way to do this or is it simply the work for computers.

P.S. Sorry for eventually bad English. It's not my native language.

No, I don't believe there is such a method. The difficulty is that since this problem requires base 10, it not really a "mathematics" problem. It is a question really of a particular representation of numbers.
• December 26th 2009, 10:09 PM
Bacterius
That's strange. Wikipedia has not got the same definition as you of pandigital numbers.

You : they use each of the digits 0,1,...,9 only once

Wiki : has among its significant digits each digit used in the base at least once

And no, I do not think that there is an easy way. But perhaps, by fiddling with moduli, you might find a way to express such 10-digit long numbers. But I haven't tried and it may not be that easy.
• December 29th 2009, 07:49 AM
Dr. Jekyll
Here's the list of the numbers I was looking for. Of course, it's computer generated. (Wink)

Thanks again for all your replies.