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$.

You can also use the inclusion-exclusion principle.
Example: $1001=7\cdot 11\cdot 13$ has three distinct prime factors, 7, 11, and 13.
among numbers from 1 to 1001, there are $143=11\cdot 13$ multiples of 7, $91=7\cdot 13$ multiples of 11, $77=7\cdot 11$ multiples of 13, 13 multiples of 77, 11 multiples of 91, 7 multiples of 143, and 1 multiple of 1001. Therefore $\phi(1001)=1001-(143+91+77)+(13+11+7)-1=720$
