Probability that $n$ integers sampled from $\{0,1,\dotsc,p-1\}$ are coprime is at least $1-p/2^n$.

coprimenumber theoryprobability

I'm trying to prove the following:

Given the set of integers $S = \{0,1,\dotsc,p-1\}$, where $p\ge2$. If $n$ integers are sampled uniformly at random from $S$, then the set of sampled integers is coprime with probability at least $1-p/2^n$.

What I mean by a set of integers $\{k_1,k_2,\dotsc,k_n\}$ being coprime is that $\gcd(k_1,k_2,\dotsc,k_n)=1$.

Any ideas?

Best Answer

The claim is false for odd $p$. Indeed, in that case the probability that a sampled number is even is slightly larger than $\frac 12$, hence there is $c>\frac12$ depending only on $p$ such that the gcd is $1$ (or at least odd) at most with probability $\le 1-c^n$. For $n\gg 0$, we have $(2c)^n>p$ and then $1-c^n<1-p/2^n$.

For even $p$, the claim is true:

We solve the cases $p=2$ and $p=4$ manually:

  • $p=2$: The probability that all samples are even is $2^{-n}$, hence the gcd is $1$ with probability $1-2^{-n}\ge 1-p/2^n$.

  • $p=4$: All samples are even ($0$ or $2$) with $2^{-n}$ and all are multiples of $3$ ($0$ or $3$) with $2^{-n}$, and both conditions occur together with probability $4^{-n}$. Hence the gcd is $1$ with probability $1-2^{-n}-2^{-n}+4^{-n}>1-2/2^n>1-4/2^n$

From now on, let $p$ be even and $\ge 6$. Let $q$ be a prime $<p$. As there are $\lceil \frac{p-1}{q}\rceil<\frac pq+1$ multiples of $q$ in the range, the probability that a sampled number is a multiple of $q$, is $\le \frac 1q+\frac1p$. Let $X_q$ be the event that the gcd of the $n$ sampled numbers is a multiple of $q$. Then $$P(\gcd=1)=1-P(X_2\lor X_3\lor X_5\lor \ldots) $$ were we run over all primes $<p$ on the right. Now $$P(X_2\lor X_3\lor X_5\lor \ldots)\le P(X_2)+P(X_3)+P(X_5)+\ldots.$$ For $5\le q<p$, we have $\frac 1q+\frac1p<\frac 2q<\frac12$ and hence $P(X_q)<\frac1{2^n}$. For $q=3$, we have $\frac1q+\frac1p\le\frac13+\frac16=\frac12$ and hence $P(X_3)\le \frac1{2^n}$. Finally, as $p$ is even, we can compute $P(X_2)=2^{-n}$ exactly. As there are at most $\frac{p}2$ primes $\le p-1$, we arrive at the bound $$P(X_2\lor X_3\lor X_5\lor \ldots)\le \frac{p}2\frac1{2^n}$$ and thus $$P(\gcd=1)\ge 1-p/2^{n+1}>1-p/2^{n}. $$

Related Question