Square any prime p and see whether there are other numbers squared that have the same last digits.

93 Views Asked by At

If I square 37 I get 1369. Excluding any solution having 37 as the last digits, can I find other numbers when squared to give me 1369 as their last digits? Solutions are any numbers having last four digits 1213, 3787, 6213, and 8787. Do all primes have such solutions and NOT having p itself as the last digits?

2

There are 2 best solutions below

0
On

It $$p\equiv 0,1,3,5,7,9\mod 10$$ then $$p^2\equiv 0,1,5,9\mod 10$$

6
On

EDITED: For any $n\ge 1$ and any $y$ coprime to $10$, $x^2 \equiv y^2 \mod 10^n$ iff $x \equiv \pm y \mod 2^{n-1}$ and $x \equiv \pm y \mod 5^n$. Thus if $n \ge 3$, there are $8$ solutions to the equation $x^2\equiv y^2 \mod 10^n$. In the case $y=37$, $n=4$, these are:

$$\matrix{x \equiv 37 \mod 2^3, & x \equiv 37 \mod 5^4 & \implies x \equiv 37 \ \text{or}\ 5037 \mod 10^4\cr x \equiv 37 \mod 2^3, & x \equiv -37 \mod 5^4 & \implies x \equiv 6213 \ \text{or}\ 1213 \mod 10^4\cr x \equiv -37 \mod 2^3, & x \equiv 37 \mod 5^4 & \implies x \equiv 3787 \ \text{or}\ 8787 \mod 10^4\cr x \equiv -37 \mod 2^3, & x \equiv -37 \mod 5^4 & \implies x \equiv 9963 \ \text{or}\ 4963 \mod 10^4\cr }$$