def _inv_totient_estimate(m):
 primes = [(d + 1) for d in divisors(m) if isprime((d + 1))]
 (a, b) = (1, 1)
 for p in primes:
  a *= p
  b *= (p - 1)
 L = m
 U = int(math.ceil((m * (float(a) / b))))
 P = p = 2
 primes = []
 while (P <= U):
  p = nextprime(p)
  primes.append(p)
  P *= p
 P //= p
 b = 1
 for p in primes[:(-1)]:
  b *= (p - 1)
 U = int(math.ceil((m * (float(P) / b))))
 return (L, U)

def _inv_totient_estimate ( m ) : primes = [ ( d + 1 ) for d in divisors ( m ) if isprime ( ( d + 1 ) ) ] ( a , b ) = ( 1 , 1 ) for p in primes : a *= p b *= ( p - 1 ) L = m U = int ( math . ceil ( ( m * ( float ( a ) / b ) ) ) ) P = p = 2 primes = [ ] while ( P <= U ) : p = nextprime ( p ) primes . append ( p ) P *= p P //= p b = 1 for p in primes [ : ( - 1 ) ] : b *= ( p - 1 ) U = int ( math . ceil ( ( m * ( float ( P ) / b ) ) ) ) return ( L , U )
find such that l <= phi^-1(m) <= u .