┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.0, Release Date: 2020-01-01 │
│ Using Python 3.7.3. Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
sage: p = lambda x: (x - 1) / 2
sage: p(11)
5
sage: is_prime(5)
True
sage: is_prime(p(11))
False
sage:
In above example, is_prime
function returns true
when called like is_prime(5)
. However, when I give it p(11)
, which returns 5, as an argument, function returns false
.
What is the reason for this behaviour, and how can I fix it?