TITLE: Probability of two integers' square sum divisible by $10$
QUESTION [5 upvotes]: 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.

REPLY [3 votes]: 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}$.