How many numbers less than $x$ are co-prime to $x$ Is there a fast way , or a direct function to give the count of numbers less than $x$ and co-prime to $x$ .
for example if $x$ = 3 ; then $n = 2$ and if $x$ = 8 ; then $n = 4$.

Here is a cool proof that I learnt on how to compute the Euler Totient Function  $\varphi$ that uses probability theory. On one hand, $\varphi(x)/x$ is the probability that a number selected between $1$ and $x$ is coprime to $x$ while we can alternatively compute the probability as follows:
A number between $1$ and $x$ is coprime to $x$ iff it is coprime to each of its prime factors. Given a prime factor $p$ of $x$, the probability that a number selected between $1$ and $p$ is coprime to $p$ is 
$$\frac{p-1}{p}.$$
Since the events of selecting when a number is coprime to each prime factor are independent, we can multiply the probabilities together to get the total probability being $\prod_{p|x} (p-1)/p$. Equating this with the result before gives you the pretty formula
$$\varphi(x) = x\prod_{p|x} \frac{p-1}{p}.$$
