Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Either I do not understand your specification or your example is incomplete. The one-liner :

sage: [v for v in sorted(set([t/u for t in (1..3) for u in (4..6)]))]
[1/6, 1/5, 1/4, 1/3, 2/5, 1/2, 3/5, 3/4]

returns elements not in your answer, but I do not understand why you exclude them.

On a related note, how can one impose a gcd(x,y)==1 in the following list?

Sage does that automatically :

sage: 2/4
1/2

To ensure unicity, use a set ; the result may be easier to read by using its sorted version (see the above one-liner).

HTH,