Created
March 20, 2022 21:48
-
-
Save vhxs/42c630ae623bf1459d6a2b62596104b2 to your computer and use it in GitHub Desktop.
Checking the cardinality of RLWE rings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# iterate over primes | |
for i, p in enumerate(Primes()): | |
# iterate over cyclotomics | |
for n in range(1, i+1): | |
# GF(p) is the finite field of order p | |
S = PolynomialRing(GF(p), 'x') | |
f = cyclotomic_polynomial(n) | |
R = QuotientRing(S, f) | |
assert R.cardinality() == p ** (f.degree()) | |
print(f"Checked equality for p == {p}, n == {n}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment