ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 11 Oct 2017 04:29:50 +0200What 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)]https://ask.sagemath.org/question/39108/what-are-the-following-commands-telling-us-rintegers-ridealab-ridealgcdab-for-a-in-range120-for-b-in-range120/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)]Wed, 11 Oct 2017 00:07:58 +0200https://ask.sagemath.org/question/39108/what-are-the-following-commands-telling-us-rintegers-ridealab-ridealgcdab-for-a-in-range120-for-b-in-range120/Answer by dan_fulea for <p>What are the following commands telling us?</p>
<pre><code>R=Integers()
[R.ideal([a,b]) == R.ideal([gcd(a,b)]) for a in range(1,20) for b in range(1,20)]
</code></pre>
https://ask.sagemath.org/question/39108/what-are-the-following-commands-telling-us-rintegers-ridealab-ridealgcdab-for-a-in-range120-for-b-in-range120/?answer=39110#post-id-39110Nice 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}
Wed, 11 Oct 2017 04:29:50 +0200https://ask.sagemath.org/question/39108/what-are-the-following-commands-telling-us-rintegers-ridealab-ridealgcdab-for-a-in-range120-for-b-in-range120/?answer=39110#post-id-39110