import sympy
import six


def _coprime_density(value):
  """Returns float > 0; asymptotic density of integers coprime to `value`."""
  factors = sympy.factorint(value)
  density = 1.0
  for prime in six.iterkeys(factors):
    density *= 1 - 1 / prime
  return density