0
$\begingroup$

I want to find all numbers less than N whose product of digits is a perfect square.

for example if N is equal to 100 then some of possible numbers are 22 (2*2), 49 (4*9=36), 2*8, 8*2 etc. I was wondering is there a mathematical relation for it.

I think if we take number in the form 10x+y (for 2 digit number) and apply conditions for perfect square we can reach to a formula.

$\endgroup$

1 Answer 1

2
$\begingroup$

For a number to be square, its prime factors must occur an even number of times.

The only possible prime factors for a number that is the product of single-digit numbers are 2, 3, 5 and 7.

5 is the only digit with a 5, so it has to happen an even number of times (including none), similarly with 7.

4 has two 2's and 2, 6, 8 have an odd number, so you have to have an even number of 2's, 6's and 8's in total, but any number of 4's.

9 has two 3's and 3, 6 have one, so you have to have an even number of 3's and 6's in total but any number of 9's.

Finally 1 won't affect the product so you can have as many 1's as you like.

So:

  • As many of 1, 4, 9 as you want.
  • An even number of 5
  • An even number of 7
  • An even number of digits chosen from 2, 6, 8
  • An even number of digits chosen from 3, 6

(Of course if it contains a 0 anywhere its digit-product will be a square.)

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .