title: How to count co-prime to n in a range [1,x] where x can be different from n?
body: <p>I want to count co-primes of n in a range [1,x]. I have tried using euler phi function but it gives for [1,n].Can anyone suggest a modification to euler phi or any other approach to do this?
  I have used phi(n) = n* product of (1-(1/p)) where p is a prime factor of n.</p>