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.Fri, 02 Feb 2018 05:03:13 +0100Listing fractionshttps://ask.sagemath.org/question/40928/listing-fractions/Hi, I would like to request help in listing rational numbers. For motivation, the command
> [x for x in IntegerRange(1,10)]
outputs the integers from 1 through 9. Is there a similar command for listing out rational numbers a/b with a and b in the range (x1,y1) and (x2,y2), respectively.
For instance, if a is in range (1,3) and b is in (4,6), I want to return
> [1/4, 1/5, 1/2, 2/5]
On a related note, how can one impose a gcd(x,y)==1 in the following list?
> [(x,y) for x in IntegerRange(1,10) for
> y in IntegerRange(1,10)]ajbFri, 02 Feb 2018 05:03:13 +0100https://ask.sagemath.org/question/40928/