The last digit of an integer is the remainder when the number is divided by 10. Any two natural numbers share the same last digit exactly when (Note: denotes "divides" and denotes "does not divide")
First prove : If is even, then is even and the difference of two even numbers is even. If is odd, then is odd, and the difference of two odd numbers is even. Thus .
Next prove . Fermat's Little Theorem: If is prime, for any integer ,
Hence for some integers . That means . Since , so since 2 is prime. Then where is an integer, and then .
Therefore
John
My calculator said it, I believe it, that settles it