-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProblem541.py
More file actions
53 lines (37 loc) · 755 Bytes
/
Problem541.py
File metadata and controls
53 lines (37 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""
Author: Austin Derrow-Pinion
Purpose: Solve Problem 541 on Project Euler
Language: Python
"""
import math
def main():
print(gcd(10, 12))
def M():
print()
def harmonicDenominator(n):
output = 0
for k in range(1, n):
output += k
return output
def simplifyHarmonicDenominator(n):
print()
def gcd(a, b):
while a != b:
if a > b:
a -= b
else:
b -= a
return a
def sieve(a, b):
""" Implementation of the Sieve of Eratosthenes """
primes = [False]*a
for i in range(2, int(math.sqrt(len(primes)))):
if primes[i] == False:
for j in range(i*i, a, i):
primes[j] = True
for i in range(a-1, 2, -1):
if (primes[i] == False) & (a % i == 0) & (b % i == 0):
return i
return 1
if __name__ == '__main__':
main()