Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to I create subsets of sets?

How do I create, for example, the set of all primes less than 100 which are congruent to 1 mod 6? In Magma, I would do something like this:

{p : p in [0..100] | IsPrime(p) and (p mod 6) eq 1};

After 25 minutes of searching the Sage documentation, googling, and trying things at random, I can't figure out how to make such a construction in Sage.

(I'm not so interested in this particular set, but rather how to do constructions like this in general [e.g., the subset of all matricies whose given minor has a certain rank, etc.).

click to hide/show revision 2
No.2 Revision

How to do I create subsets of sets?

How do I create, for example, the set of all primes less than 100 which are congruent to 1 mod 6? In Magma, I would do something like this:

{p : p in [0..100] | IsPrime(p) and (p mod 6) eq 1};

After 25 minutes of searching the Sage documentation, googling, and trying things at random, I can't figure out how to make such a construction in Sage.

(I'm not so interested in this particular set, but rather how to do constructions like this in general [e.g., the subset of all matricies whose given minor has a certain rank, etc.).