On 09/04/2012 21:02, Kent Morrison wrote:
In this snippet of Sage code I believe that pos is [1,2,3]. But mod(1,p)
in pos evaluates to False, while mod(1,p) in [1,2,3] evaluates to True.
However 1%p in pos and 1%p in [1,2,3] both evaluate to True.
This behaviour can be understood by using the ty
Note:
sage: type(mod(1,p))
sage: type(1%p)
sage: type(pos[0])
There is no coercion between rationals and integers modulo a number.
There is on the other hand a coercion from integers to integers modulo
a number. In all the comparisons that returned true Sage knows how to
coerce both sides in
In this snippet of Sage code I believe that pos is [1,2,3]. But mod(1,p)
in pos evaluates to False, while mod(1,p) in [1,2,3] evaluates to True.
However 1%p in pos and 1%p in [1,2,3] both evaluate to True.
p=7
pos=[1..(p-1)/2]
pos==[1,2,3], mod(1,p) in pos, mod(1,p) in [1..3], 1%p