Given a natural number $n\in[1,N]$, the probability of $n$ being a perfect square is $\frac{1}{\sqrt{N}}$.
What would be the probability, if we knew the units-digit in the decimal representation of $n$?
I have figured out the following:
- $d=0 \implies p=K$
- $d=1 \implies p=2K$
- $d=2 \implies p=0$
- $d=3 \implies p=0$
- $d=4 \implies p=2K$
- $d=5 \implies p=K$
- $d=6 \implies p=2K$
- $d=7 \implies p=0$
- $d=8 \implies p=0$
- $d=9 \implies p=2K$
I assume that $K$ should be derived from $\frac{1}{\sqrt{N}}$, but I'm not quite sure how.
I was thinking, perhaps the above probabilities should sum up to $\frac{1}{\sqrt{N}}$.
This would yield $K=\frac{1}{10\sqrt{N}}$.
Is that correct, or do I need to take a different approach here?
The probabilities should not sum up to $\frac1{\sqrt N}$. Contemplate the problem with "square" replaced with "even", where you should have $p=1$ or $p=0$, depending on the unit digit being even/odd, whereas the overall probaility is $\frac12$.
Instead, your $K$ should be just $\frac1{\sqrt N}$, do you see why?