Probability of two integers' square sum divisible by $10$
Given two random integers $a$, $b$ calculate probability of $a^2$ + $b^2$ is divisible by $10$.
I've tried to simulate this process and got a result about $0.18$ (maybe incorrect), but have no idea why.
Final digit of a and b as follows
(0,0); (1,3)(1,7); (2,4)(2,6); (3,1)(3,9); (4,2)(4,8); (5,5); (6,2)(6,8); (7,1)(7,9); (8,4)(8,6); (9,3)(9,7)
That's 18 possibilities out of 100
It is natural to assume that both $a$ and $b$ are independently and uniformly distributed mod $2$ as well as mod $5$.
Then $a^2+b^2$ is even iff $a\equiv b$ mod $2$, which happens with probability ${1\over2}$.
The $5$ elements of ${\mathbb Z}_5$ have squares $0,1,-1,-1,1$ mod $5$. The probability that two such squares add up to $0$ mod $5$ therefore is $={1\over25}+{4\over5}\cdot{2\over5}={9\over25}$.
The probability that $a^2+b^2\equiv0$ mod $10$ is then given by ${1\over2}\cdot{9\over25}={9\over50}$.