Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Create an infinite set with list comprehension

Hello. In Sage is possible to create B = Set(Primes()). For B Sage says Set of all prime numbers: 2, 3, 5, 7, ... . So B is infinite. I try to create now a set C = Set([x^2 for x in QQ]). I am expecting to get something similar like above, but Sage does not get so far. After some 20 Minutes of waiting I broke down the action. Is possible to create an infinite Set with list comprehension? I know that lists should befinite but the notation used by list comprehension is very near on the mathematical way to describe a set like D = Set([x^2 for x in range(10)]) for example. Any help appreciated. Thank you and regards, Vasile