def is_lucas_prp(n):
 n = as_int(n)
 if (n == 2):
  return True
 if ((n < 2) or ((n % 2) == 0)):
  return False
 if is_square(n, False):
  return False
 (D, P, Q) = _lucas_selfridge_params(n)
 if (D == 0):
  return False
 (U, V, Qk) = _lucas_sequence(n, P, Q, (n + 1))
 return (U == 0)

def is_lucas_prp ( n ) : n = as_int ( n ) if ( n == 2 ) : return True if ( ( n < 2 ) or ( ( n % 2 ) == 0 ) ) : return False if is_square ( n , False ) : return False ( D , P , Q ) = _lucas_selfridge_params ( n ) if ( D == 0 ) : return False ( U , V , Qk ) = _lucas_sequence ( n , P , Q , ( n + 1 ) ) return ( U == 0 )
standard lucas compositeness test with selfridge parameters .