Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let $A=\{i: 1 \leq i \leq n\} \subset \mathbb{N} $ and $B \subset A$, $|B|=k$ ($k < n$). What's the probability that $\gcd(B)>1$?

EDIT: $n$ and $k$ are given. I think this can be solved with inclusion-exclusion principle?

share|cite|improve this question
Perhaps it may be useful to know that the probability that a number $k < n$ selected being coprime to $n$ is $\phi(n)/n$. – user38268 Aug 5 '12 at 8:42

Not a complete solution, but a direction:

Let's denote by $A_p$ the event $\forall a\in B,p |a$. We want to know the probability of $\bigcup_{p \space prime}^{} A_p$.

Since we have We have $\lfloor\frac np\rfloor$ numbers that sivisible by $p$, we can get that $p(A_p)=\dfrac{|A_p|}{|\Omega|}=\dfrac{\big\lfloor\frac np\big\rfloor \choose k}{n\choose k}$.

$p(A_p)$ vanishes for $\lfloor\frac np\rfloor \lt k$.

Also, we have $A_p \cap A_q=A_{p \times q}$ for any $p$, $q$ primes.

So we can proceed with inclusion-exclusion principle: $$p(n,k)=\sum_{p \space prime}\dfrac{\big\lfloor\frac np\big\rfloor \choose k}{n\choose k}-\sum_{p, q\space primes}\dfrac{\big\lfloor\frac n{p\cdot q}\big\rfloor \choose k}{n\choose k}+...$$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.