# Permutation: How many numbers of n digits are possible for which product of its digits is a perfect square.

I need to find total numbers from 1 to 10000 whose product of digit is a perfect square.

eg: 49 (4*9=36), 236 ( 2*3*6=36) etc.

Till now i have figured out these things: 1) For a number to be a perfect square it must have even number of prime factors.

2)For a single digits factors possible are 1,2,3,5,7

hence if we are dealing with n digits we need to find total number of permutation for every digit such that there product will be in the form of even factors. eg: for 236 our digits are 2, 3 and 6. 6 can be factorized to 2X3. hence product of digits will become 2X3X2X3. for n= 1 2 3 4 ans is 4 30 312 3560

I understood the concept but i am unable to derive a formula for total permutations for n digits. Can you help me?

The numbers break into classes. $1,4,9$ are interchangeable, as are $2,8$, so find numbers formed from $1,2,3,5,6,7$ and multiply by $3$ for each $1$ and by $2$ for each $2$
$5$ and $7$ have to come in pairs