1

Consider the numbers $1,2,3,\dotso ,n$.

What is the probability that a random number is divisible by a prime $p$ ?

The answer is given to be $\frac{1}{p}.$

However I am not convinced. How is this true?

If I consider $n=10,$ and take $p=3$ then no. of elements divisible by $p=3$ are 3,6,9 then the probability becomes $\frac{3}{10}$.

So how is this correct?

Can someone please help?

  • It's clearly false without further assumptions. E.g. consider $n = 10$ and $p = 11$. –  Oct 08 '18 at 05:19
  • It's not a bad approximation if $n $ is several times more than $p $. If $bp\le n <(b+1)p $ then the real $Pr $ is $\frac 1p\frac b {b+1}<Pr \le \frac 1p $ – fleablood Oct 08 '18 at 06:05

3 Answers3

3

The actual probability is $\lfloor n/p \rfloor/n$.

What is true is that the limit as $n \to \infty$ is $1/p$. That is because $$\frac{1}{p} - \frac{1}{n} = \frac{(n/p-1)}{n} < \frac{\lfloor n/p\rfloor}{n} \le \frac{1}{p}$$

Robert Israel
  • 448,999
0

The answer is an estimate and clearly wrong if $p $ doesn't divide $n $.

Suppose $n=b*p+r;0\le r <p $ so $b=[\frac np] $ where $[x] $ is the floor function.

Prob is $\frac b {b*p+r}=\frac {b+\frac rp -\frac rp}{b*p+r}=\frac 1 p - \frac r {np} $. Now $\frac r {np} $ may be small, especially if $n $ is much bigger than $p $. (And it can be $0$ if $p|n $). But it can be significant to throw your answer off. And if $p>n $, well... the the prob is $0$, isn't it?

In your case $\frac 3 {10}=\frac 13-\frac 1 {30} $. It's close to $\frac 13$ but it's not exact.

The time it will be most off (other than $p>n $) will be when $n=2p-1$. The estimation is nearly $50\% $ off! Example: $n=19$ and $p=10$. Actual probability is $\frac 1 {19} $, not $\frac 1 {10} $. (But if $p>n $ the prob is $100\% $ off!!)

However all in all, It's not a bad approximation if $n $ is several times more than $p $. If $bp\le n <(b+1)p $ then the real $Pr $ is $\frac 1p\frac b {b+1}<Pr \le \frac 1p $

And clearly the limit as $n $ goes to infinity is $\frac 1p $.

I suspect this is meant to answer "if you randomly picked a natural number from all natural numbers what would the probability be". However, there are practical reasons that "picking a random item from an infinite number of items" is not well defined. So it isn't fair to ask that question.

fleablood
  • 124,253
0

I was searching for this when I came across another post in Stack Exchange, "To what extent are divisibility by different primes independent?". This sort of cleared my confusion. If we forget for the time being that $p$ is prime, the logic holds true for irrespective of whether it is prime or not. Consider the residue class of $p$, ie, $$\{n\in\mathbb{N}|n\equiv r(mod~p)\},~\text{where}~0\leq r\leq p-1$$ Said in simpler terms, any random no. can have remainder ${0,\ldots,p-1}$. Since there are $p$ such classes, and each class is equiprobable, the probability is $1/p$.