Skip to content

Commit 743830a

Browse files
Add solution for problem 810
1 parent 67babd3 commit 743830a

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

project_euler/problem_810/sol1.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
2828
"""
2929

30-
from bitarray import bitarray
31-
3230

3331
def xor_multiply(a: int, b: int) -> int:
3432
"""
@@ -92,15 +90,8 @@ def count_irreducibles(d: int) -> int:
9290
Count the number of irreducible polynomials of degree d over GF(2)
9391
using the Möbius function.
9492
95-
Args:
96-
d (int): Polynomial degree.
97-
98-
Returns:
99-
int: Count of irreducible polynomials.
100-
101-
Example:
102-
>>> count_irreducibles(3)
103-
2
93+
>>> count_irreducibles(3)
94+
2
10495
"""
10596
mob = mobius_table(d)
10697
total = 0
@@ -126,9 +117,8 @@ def find_xor_prime(rank: int) -> int:
126117

127118
limit = 1 << (degree + 1)
128119

129-
sieve = bitarray(limit)
130-
sieve.setall(True)
131-
sieve[0:2] = False
120+
sieve = [True] * limit
121+
sieve[0] = sieve[1] = False
132122

133123
for even in range(4, limit, 2):
134124
sieve[even] = False

0 commit comments

Comments
 (0)