From 21a344d036b15cb1f5ed6659b2e95091cba553cd Mon Sep 17 00:00:00 2001 From: mhostetter Date: Thu, 30 Nov 2023 19:15:35 -0500 Subject: [PATCH] Fix formatting --- src/galois/_prime.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/galois/_prime.py b/src/galois/_prime.py index 7389046fb..c6647361a 100644 --- a/src/galois/_prime.py +++ b/src/galois/_prime.py @@ -170,17 +170,15 @@ def prev_prime(n: int) -> int: if n <= MAX_N: return PRIMES[bisect.bisect_right(PRIMES, n) - 1] - shifts = [29, 23, 19, 17, 13, 11, 7, 1] # Factorization wheel for basis {2, 3, 5} - base = n // 30 * 30 # Wheel factorization starting point - found = False # Success flag + shifts = [29, 23, 19, 17, 13, 11, 7, 1] # Factorization wheel for basis {2, 3, 5} + base = n // 30 * 30 # Wheel factorization starting point + found = False # Success flag while not found: for shift in shifts: - i = base + shift # May be bigger than n - + i = base + shift # May be bigger than n if i >= n: continue - if is_prime(i): found = True break @@ -219,17 +217,15 @@ def next_prime(n: int) -> int: if n < PRIMES[-1]: return PRIMES[bisect.bisect_right(PRIMES, n)] - shifts = [1, 7, 11, 13, 17, 19, 23, 29] # Factorization wheel for basis {2, 3, 5} - base = n // 30 * 30 # Wheel factorization starting point. May be less than n. - found = False # Success flag + shifts = [1, 7, 11, 13, 17, 19, 23, 29] # Factorization wheel for basis {2, 3, 5} + base = n // 30 * 30 # Wheel factorization starting point. May be less than n. + found = False # Success flag while not found: for shift in shifts: i = base + shift - if i <= n: continue - if is_prime(i): found = True break