# summation of all $n$ digit number containing with digits?

find sum of all $3$ digit numbers such that all digits are perfect square no digit being zero ?

i did this $\{1,4,9\}$

at units place $1 \to 2$ times $4 \to 2$ times $9 \to 2$ times hence sum of digits at one's place$= 2\cdot 1+2\cdot 4+2\cdot9=28$

at tens place $1 \to 2$ times $4 \to 2$ times $9 \to 2$ times hence sum of digits at ten's place$= 2\cdot 1+2\cdot 4+2\cdot 9=28$

at hundreds place $1 \to 2$ times $4 \to 2$ times $9 \to 2$ times hence sum of digits at hundred's place$= 2\cdot 1+2\cdot 4+2\cdot 9=28$

therefore total sum is \begin{align}28100+28\cdot 10+28\cdot 1 &=28\cdot 111 \\&=3108 \end{align}

BUT THE ANSWER IS $13986$... please explain

• 0 is a perfect square. – fleablood Apr 13 '18 at 5:06
• @fleablood +1, yet I believe that still doesn't sum to what OP says it should. – Thomas Bladt Apr 13 '18 at 5:11
• @fleablood the answer $13986$ suggests one only count those with digits $1, 4, 9$. When $0$ is allowed, the answer becomes $24248$ – achille hui Apr 13 '18 at 5:12
• @fleablood sorry i forgot to mention that no digit must be zero – Vani Sharma Apr 13 '18 at 5:12
• Hint: If only $1,4,9$ are allowed to form numbers, there are totally 27 numbers to sum. nine of them has the form 1xx, nine has the form 4xx, similar things happen to other digits and at different positions. – achille hui Apr 13 '18 at 5:13

You are only counting numbers that are a permutation of $1,4,9$. You have not counted numbers like $444$ or $441$ which have a matching pair of digits. You should have $1$ in the units place counted $3^2=9$ times because each other place has $3$ choices, so the answer is $(1+4+9)999=14(1000-1)=13986$