# What are the following commands telling us? R=Integers() [R.ideal([a,b]) == R.ideal([gcd(a,b)]) for a in range(1,20) for b in range(1,20)]

What are the following commands telling us?

R=Integers()
[R.ideal([a,b]) == R.ideal([gcd(a,b)]) for a in range(1,20) for b in range(1,20)]

edit retag close merge delete

Sort by » oldest newest most voted

Nice homework!

sage: J = [1..50]
sage: Set( [ bool( ZZ.ideal( [a,b] ) == ZZ.ideal( gcd(a,b) ) ) for a in J for b in J ] )
{True}


means that for two integers $a,b$ in the rather small interval of integers $J$ from $1$ to $50$ we have the equality of the ideals which are generated by:

• $a$ and $b$ (two generators),
• respectively by their gcd (one generator).

New homework:

What is telling us the following?

sage: Set( [ bool( ZZ.ideal( [a,b,c] ) == ZZ.ideal( gcd([a,b,c]) ) ) for a in J for b in J for c in J ] )
{True}


Bonus:

What is telling us the following?

sage: C = cartesian_product( [ range(100, 120) for _ in range(4) ] )
sage: C.random_element()
(114, 119, 111, 106)
sage: Set( [ bool( ZZ.ideal(list(c)) == ZZ.ideal( gcd(list(c)) ) ) for c in C ] )
{True}

more