# What is the probability a random number I select is a perfect square [duplicate]

Yes, let's simplify the problem by assuming the set of only positive integers $$Z$$ I know if I take a range of numbers say $$1$$ to $$10$$ , there are only three perfect square existing here; which are $$1$$ , $$4$$ and $$9$$ So the probability is $$3/10$$ If I increase my range the probability becomes lesser, so I can conclude there are more imperfect-square numbers than perfect squares.

My question Is there any fixed value assign to this, can I know the minimum and maximum value of this probability

• You need to specify more things. Whats a perfect square? Simply x s.t. sqrt(x) is an integer again? What is the probability distribution on lN ? Or are we considering {1, ..., n}? – Stockfish Mar 29 '20 at 13:27
• A perfect square. X ( a positive integer ) , x s.t. sqrt(X) is a positive integer again. we are considering {1,2,3,.…........,n}, considering all the set of positive integer again – Aderinsola Joshua Mar 29 '20 at 13:35
• If $n$ tends to $\infty$ , the probability that a random number in the range $[1,n]$ is a perfect square, tends to $0$. So , if we allow the random number to be any positive integer, the probability is $0$. – Peter Mar 29 '20 at 13:38
• en.wikipedia.org/wiki/Natural_density – saulspatz Mar 29 '20 at 13:50

The probability that a uniformly chosen integer in $$\{1,2,\ldots, n\}$$ is a perfect square is given by $$p_n={\lfloor\sqrt{n}\rfloor\over n}\ ,$$ because there are exactly $$\lfloor\sqrt{n}\rfloor$$ perfect squares in $$\{1,2,\ldots, n\}$$. As $$\sqrt{n}-1<\lfloor\sqrt{n}\rfloor\leq\sqrt{n}$$ we therefore can say that $${1\over\sqrt{n}}-{1\over n} which proves that $$\lim_{n\to\infty} p_n=0$$.