Skip to content

Commit

Permalink
add euler027 solution
Browse files Browse the repository at this point in the history
  • Loading branch information
kailanefelix committed Oct 15, 2021
1 parent dec594a commit b5664b5
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions euler0XX/euler027.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from euler0xx.numbertools import is_prime
from itertools import count

max_sequence = 0
for b in range(-1000, 1001):
if not is_prime(b):
continue

for a in range(-999, 1000):
sequence = 0
for n in count(0):
number = n * n + (a + (b + 1) % 2) * n + b
if not is_prime(number):
break

sequence = sequence + 1

if sequence > max_sequence:
max_sequence = sequence
product = a * b

print(product)

0 comments on commit b5664b5

Please sign in to comment.