We define the function $Z(A)$ where we write the digits of $A$ in base $10$ form in reverse. (For example: $Z(521)=125$). Call a number $A$ $good$ if the first and last digits of $A$ are different, none of it's digits are $0$ and the equality: $$Z(A^2)=(Z(A))^2$$happens. Find all such good numbers greater than $10^6$.
AriizuZDR wrote:
We define the function $Z(A)$ where we write the digits of $A$ in base $10$ form in reverse. (For example: $Z(521)=125$). Call a number $A$ $good$ if the first and last digits of $A$ are different, none of it's digits are $0$ and the equality: $$Z(A^2)=(Z(A))^2$$happens. Find all such good numbers greater than $10^6$.
Note that $A$ good number implies $Z(A)$ good number too. So WLOG rightmost digit of $A$ greater than leftmost digit.
Let $n\ge 6$ be the number of digits of the cool number $A$.
1) Rightmost digit $\in\{2,3\}$ and $A^2$ has $2n-1$ digits.
Since rightmost digit is greater than leftmost digit, it is $\ge 2$.
If rightmost digit is $4$, $A^2$ ends with $6$ while $Z(A)^2$ begins by $16-24$, impossible
If rightmost digit is $5$, $A^2$ ends with $5$ while $Z(A)^2$ begins by $25-35$, impossible
If rightmost digit is $6$, $A^2$ ends with $6$ while $Z(A)^2$ begins by $36-48$, impossible
If rightmost digit is $7$, $A^2$ ends with $9$ while $Z(A)^2$ begins by $49-63$, impossible
If rightmost digit is $8$, $A^2$ ends with $4$ while $Z(A)^2$ begins by $64-80$, impossible
If rightmost digit is $9$, $A^2$ ends with $1$ while $Z(A)^2$ begins by $81-99$, impossible
So leftmost digit of $A$ is $\le 2$ and $A^2$ has $2n-1$ digits
Q.E.D.
2) If rightmost digit is $3$, no good number.
If rightmost digit is $3$, $A^2$ ends with $9$ and so $Z(A^2)=Z(A)^2$ begins by $9$
And so $Z(A)\in[\sqrt{9}10^{n-1},\sqrt{10}10^{n-1})=[30000...,31622...)$
So next digit from the right is $1$ (since $Z(A)<32000...$)
So $A$ ends with $13$, $A^2$ ends with $69$ and $Z(A^2)=Z(A)^2$ begins by $96$
And so $Z(A)\in[\sqrt{9.6}10^{n-1},\sqrt{9.7}10^{n-1})=[3098...,31144...)$
So next digit from the right is $1$ again (since $Z(A)<31200...$)
So $A$ ends with $113$, $A^2$ ends with $769$ and $Z(A^2)=Z(A)^2$ begins by $967$
And so $Z(A)\in[\sqrt{9.67}10^{n-1},\sqrt{9.68}10^{n-1})=[31096...,311126..)$
So next digit from the right is $1$ again (since $Z(A)<311200...$)
So $A$ ends with $1113$, $A^2$ ends with $8769$ and $Z(A^2)=Z(A)^2$ begins by $9678$
And so $Z(A)\in[\sqrt{9.678}10^{n-1},\sqrt{9.679}10^{n-1})=[31109...,3111109..)$
And so no such good number (since sixth digit from the right would be zero)
Q.E.D.
3) Solutions when rightmost digit is $2$.
$A^2$ ends with $4$ and so $Z(A^2)=Z(A)^2$ begins by $4$ and so
$Z(A)\in[\sqrt{4}10^{n-1},\sqrt{5}10^{n-1})=[20000...,2236...)$
So next digit from the right is $1$ or $2$ (since $Z(A)<23000...$)
3.1) if rightmost digits are $22$, no such good number
ProofSo $A$ ends with $22$, $A^2$ ends with $84$ and $Z(A^2)=Z(A)^2$ begins by $48$
And so $Z(A)\in[\sqrt{4.8}10^{n-1},\sqrt{4.9}10^{n-1})=[21908...,22135...)$
So next digit from the right is $1$ (since $Z(A)<22200...$)
So $A$ ends with $122$, $A^2$ ends with $884$ and $Z(A^2)=Z(A)^2$ begins by $488$
And so $Z(A)\in[\sqrt{4.88}10^{n-1},\sqrt{4.89}10^{n-1})=[22090...,221133...)$
So next digit from the right is $1$ again (since $Z(A)<221200...$)
So $A$ ends with $1122$, $A^2$ ends with $8884$ and $Z(A^2)=Z(A)^2$ begins by $4888$
And so $Z(A)\in[\sqrt{4.888}10^{n-1},\sqrt{4.889}10^{n-1})=[221088...,2211108...)$
And so no such good number (since sixth digit from the right would be zero)
Q.E.D.
3.2) if rightmost digits are $12$
So $A$ ends with $12$, $A^2$ ends with $44$ and $Z(A^2)=Z(A)^2$ begins by $44$
And so $Z(A)\in[\sqrt{4.4}10^{n-1},\sqrt{4.5}10^{n-1})=[20976...,21213...)$
So next digit from the right is $1$ or $2$ (since $Z(A)<21300...$)
3.2.1) if rightmost digits are $212$, no such good number
ProofSo $A$ ends with $212$, $A^2$ ends with $944$ and $Z(A^2)=Z(A)^2$ begins by $449$
And so $Z(A)\in[\sqrt{4.49}10^{n-1},\sqrt{4.50}10^{n-1})=[21896...,21213...)$
So next digit is $1$ (since $Z(A)<21220...$)
So $A$ ends with $1212$, $A^2$ ends with $8944$ and $Z(A^2)=Z(A)^2$ begins by $4498$
And so $Z(A)\in[\sqrt{4.498}10^{n-1},\sqrt{4.499}10^{n-1})=[212084...,212108...)$
And so no such good number (since fifth digit from the right would be zero)
Q.E.D.
3.2.2) if rightmost digits are $112$, two solutions
SolutionsSo $A$ ends with $112$, $A^2$ ends with $544$ and $Z(A^2)=Z(A)^2$ begins by $445$
And so $Z(A)\in[\sqrt{4.45}10^{n-1},\sqrt{4.46}10^{n-1})=[21095...,211187...)$
So next digit from the right is $1$ (since $Z(A)<21120...$)
So $A$ ends with $1112$, $A^2$ ends with $6544$ and $Z(A^2)=Z(A)^2$ begins by $4456$
And so $Z(A)\in[\sqrt{4.456}10^{n-1},\sqrt{4.457}10^{n-1})=[211092...,2111160...)$
So next digit from the right is again $1$ (since $Z(A)<211120...$)
So $A$ ends with $11112$, $A^2$ ends with $76544$ and $Z(A^2)=Z(A)^2$ begins by $44567$
And so $Z(A)\in[\sqrt{4.4567}10^{n-1},\sqrt{4.4568}10^{n-1})=[2111089...,21111134...)$
So next digit from the right is again $1$ (since $Z(A)<211112...$)
So $A$ ends with $111112$ and the only six digit in this category could be $111112$ which indeed fits
If $A$ has more than 6 digits, then $A^2$ ends with $876544$ and $Z(A^2)=Z(A)^2$ begins by $445678$
And so $Z(A)\in[\sqrt{4.45678}10^{n-1},\sqrt{4.45679}10^{n-1})=[21111087...,2111111089...)$
So next digit from the right is $1$ again since $Z(A)<2111112...$) and no possible eighth digit (which would be zero)
And indeed $A=1111112$ fits
And so, back to the WLOG, only four good numbers with at least six digits :
$\boxed{A\in\{111112,211111,1111112,2111111\}}$