Ask Your Question

Revision history [back]

The number (11 - 1) / 2 is a rational number not an integer

sage: parent(5)
Integer Ring
sage: parent((11 - 1) / 2)
Rational Field

As these objects are of different nature, the operation is_prime behave differently on each of them. You should consider using one of the two workaround

sage: is_prime( (11 - 1) // 2)  # floor division returns integer
True
sage: is_prime( Integer( (11 - 1) / 2 ) )  # conversion Rational -> Integer
True

The number (11 - 1) / 2 is a rational number not an integer

sage: parent(5)
Integer Ring
sage: parent((11 - 1) / 2)
Rational Field

As these objects are of different nature, the operation is_prime behave behaves differently on each of them. You should consider using one of the two workaroundworkarounds

sage: is_prime( (11 - 1) // 2)  # floor division returns integer
True
sage: is_prime( Integer( (11 - 1) / 2 ) )  # conversion Rational -> Integer
True