Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here is one solution:

sage: [p for p in [0..100] if is_prime(p) and (p%6)==1]
[7, 13, 19, 31, 37, 43, 61, 67, 73, 79, 97]

For more documentation on this, look for list comprehensions in your favorite Python documentation.