Skip to content

Commit b37eca3

Browse files
author
Release Manager
committed
sagemathgh-41122: Subsets of primes defined by congruence conditions We implement subsets of primes given by congruence conditions and operations on those sets. Here is a short demo. ``` sage: P = Primes(modulus=4); P Set of prime numbers congruent to 1 modulo 4: 5, 13, 17, 29, ... sage: P[:10] [5, 13, 17, 29, 37, 41, 53, 61, 73, 89] sage: P.next(500) 509 sage: for p in P: ....: if p > 50: break ....: print(p) 5 13 17 29 37 41 ``` ``` sage: P = Primes(modulus=4); P Set of prime numbers congruent to 1 modulo 4: 5, 13, 17, 29, ... sage: Q = Primes(modulus=4, classes=[3]) Set of prime numbers congruent to 3 modulo 4: 3, 7, 11, 19, ... sage: PQ = P.union(Q) sage: PQ Set of all prime numbers with 2 excluded: 3, 5, 7, 11, ... sage: PQ == Primes().exclude(2) True ``` Cc @FloFuer ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. URL: sagemath#41122 Reported by: Xavier Caruso Reviewer(s): Martin Rubey, Xavier Caruso
2 parents 9a54afc + 1ef8180 commit b37eca3

File tree

1 file changed

+1047
-93
lines changed

1 file changed

+1047
-93
lines changed

0 commit comments

Comments
 (0)