Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You just found a bug in Sage. Sage does not have enough knowledge to know that the set of rationals that are not prime numbers is infinite. If there was no bug, you'd have an error saying something like "Sage cannot compute the cardinality of B".

However, if you type B.cardinality??, you'll notice that what the function does is simply return len(list(self)), i.e. it constructs the list of ALL rationals that are not prime numbers, and returns its length. You get no answer because it's entered an infinite loop.