The square of a number's last few digits remain the same. The number $9376$ has a property that the last four digits of $9376^2$ remain the same.
How many $4$ digit numbers have this property?
Are there values of $n>4$ such that a $n$-digit number has $n$ digits unchanged at the end after squaring?
Thank you for your help!
 A: It suffices to find the solutions to $x^2 \equiv x \mod 16$ and $x^2 \equiv x \mod 625$. As these polynomials are degree two and we're looking at solutions mod prime powers, there are at most two solutions to each by Hensel's lemma. Each has only the solutions $x \equiv 0, 1$. These extend via CRT to solutions $0, 1, 625, 9376$.
The OEIS lists a sequence of least $n$-digit integers such that $a_n^2$ ends in $a_n$. 
EDIT: Ross Millikan, in the comments below, notes that the CRT solution given here gives us two non-trivial (not $0$ and not $1$) such integers for each $n$. Let $x$ be one of them and $y$ be the other. Then one is $0$ mod $2^n$ and the other is $0$ mod $5^n$; their product is $0$ mod $10^n$. So $(x+y)^2 = x^2 + 2xy + y^2 \equiv x^2 + y^2 \equiv x+y \mod 10^n$; this gives us another solution to $x^2 \equiv x$ that is not divisible by $2$; so it is $1$. Thus $x+y \equiv 1 \mod 10^n$. This, along with the fact that neither $x$ nor $y$ are $1$, proves that there exists such an integer of length $n$ for all $n$.
A: I know that this question has been sufficiently answered already, but just in case you're curious, I made this python program that finds these numbers:
x = input("Input Amount of Digits")  
y = 1  
z = 9  
for a in range(1, int(x)):  
    y = y*10 #Lower Bound  
    a = a+1  
for b in range(1, int(x)):  
    z = ((z*10)+9)  
    b = b+1      
print("Puzzle: There is one x-digit whole number n, such that the last x digits   of n2 are in fact the original number n.")  
print("Answers:")  
for c in range(y, z):  
    numstring = str(c**2)  
    if(int(numstring[-(int(x)):]) == c):  
        print(c)  
    else:  
        c = c+1  
input("Done. Press Enter to Exit.")

