# 1980 AHSME Problems/Problem 30

A six digit number (base 10) is squarish if it satisfies the following conditions:

(i) none of its digits are zero;

(ii) it is a perfect square; and

(iii) the first of two digits, the middle two digits and the last two digits of the number are all perfect squares when considered as two-digit numbers.

How many squarish numbers are there?

$$\text{(A)} \ 0 \qquad \text{(B)} \ 2 \qquad \text{(C)} \ 3 \qquad \text{(D)} \ 8 \qquad \text{(E)} \ 9$$

I cannot access soution for this problem. Can someone please explain how it can be done.

• What have you tried? – Don Thousand Nov 10 '19 at 5:03
• I think there are too many permutation, so not getting a efficent way to solve this. Let's say no. is abcdef then ab,cd,ef = {x^2 where x:4 to 9} – Anushi Maheshwari Nov 10 '19 at 5:07

Assume that a squarish number is $$(100a+10b+c)^2$$ with $$a,b,c\in\{0,1,\ldots,9\}$$.

Because $$10^4a^2\le (100a+10b+c)^2=10^4 a^2+2000ab+100b^2+200ac+20bc+c^2<10^4(a+1)^2$$ we see that:

• For the top two digits to form a square, they must be $$a^2$$ specifically. Because zero is not allowed, we can deduce that $$a\in[4,9]$$.
• Carry from $$2000ab$$ into the top two digits will ruin this whenever $$ab\ge5$$. Given that $$a\ge4$$ this forces $$b=0$$. Initially we still have $$a=4, b=1$$ as a possibility. As $$\sqrt{17}=4.123\ldots$$ we are to treat the cases $$c\in\{1,2\}$$. But then $$20bc=20c$$ will change the two lowest digits ruining this possibility.
• Thus $$b=0$$ and the squarish number is $$10^4a^2+100\cdot(2ac)+c^2.$$ Furthermore, also $$c\in[4,9]$$ for otherwise the next to last digit would be a zero.

We need $$2ac$$ to be a two digit square. It is relatively easy to see that the only possibilities are $$\{a,c\}=\{4,8\}$$ one way or the other. I did it by looking at the prime factors of $$a$$ and $$c$$ respectively, keeping in mind that one of them must be even. The pair $$8,9$$ would also make $$2ac$$ a square, but then $$2ac>100$$). The pairs $$\{3,6\}$$,$$\{2,4\}$$,$$\{1,2\}$$ and $$\{1,8\}$$ would also make $$2ac$$ a square, but earlier we saw that both $$a$$ and $$c$$ must be at least $$4$$, so these, too, must be excluded.

This leaves $$408^2=166464\quad\text{and}\quad804^2=646416$$ as the only squarish numbers.

• Thanks @Jyrki Lahtonen for your answer and valuable comments :) – Anushi Maheshwari Nov 10 '19 at 12:18

The $$2$$ digit square numbers are $$16,25,36,49,64,81$$. Note that square numbers can't be congruent to $$2\mod3$$. Note that $$16,25,49,64\equiv1\mod3$$, while the rest are divisible by $$3$$.

Since a $$6$$ digit square must also be congruent to $$0,1\mod 3$$, and the sum of the digits of a number is congruent to the number modulo $$9$$, we have two possibilities for our $$6$$ digit prime.

1. It is composed of numbers from $$\{16,25,49,64\}$$

2. It is composed of numbers from $$\{36,81\}$$.

Next, we note that squares are congruent to $$0,1\mod8$$. Hence, so must the last three digits of the number.

Let's analyze case 2 first. Note that if the square ended in $$81$$, the middle square must be $$36$$, since $$8\not\mid 180$$. If the square ended in $$36$$, the middle square must be $$81$$ for similar reasons.

So for case $$2$$, we have $$4$$ remaining possibilities. Any square in front, followed by either $$3681$$ or $$8136$$.

Now we divide each of these possibilities by $$9$$ to get $$90409,40409,40904,90904$$. We can remove two of these cases as they are congruent to $$2\mod3$$. We are left with $$90409$$ and $$90904$$. We can remove $$90904$$ since it is not divisible by $$8$$. $$90409$$ is close to $$90000$$ which is $$300^2$$. $$301^2=90000+600+1>90409$$, showing that it too, isn't a square.

So, there were no successful results from case $$2$$. So, we solely need to consider squares in $$16, 25, 49, 64$$. Note that the middle square must have an even ones digit to ensure the six digit square is congruent to $$0,1\mod8$$. Since $$10101$$ is clearly not a square (too close to $$10000$$), there are no six-digit squares with any $$2$$ digit square repeated thrice.

You can finish the casework from here.

• Why are you excluding for example the case of a single $64$ accompanied by two of $36,81$? That leaves a number congruent to $1$ modulo $9$, and hence a possible square. – Jyrki Lahtonen Nov 10 '19 at 5:41
• What I'm saying that for example 811681 passes all your tests. It is $\equiv1\pmod3$, and $681\equiv1\pmod8$. – Jyrki Lahtonen Nov 10 '19 at 5:54
• @JyrkiLahtonen I don't know how I missed that. I clearly need some coffee. Will fix in a bit, – Don Thousand Nov 10 '19 at 6:01
• Thanks, @DonThousand for your answer :) – Anushi Maheshwari Nov 10 '19 at 12:17