Problem

Source: Kazakhstan National Olympiad 2022 Grade 10-11 P2

Tags: number theory, Digits, function



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$.