mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-05-23 08:51:31 -04:00
reorganize dir
Signed-off-by: Mia Steinkirch <mia.steinkirch@gmail.com>
This commit is contained in:
parent
1b6f705e7c
commit
a8e71c50db
276 changed files with 23954 additions and 0 deletions
44
other_resources/Project-Euler/.gitignore
vendored
Normal file
44
other_resources/Project-Euler/.gitignore
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
env/
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.coverage
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
22
other_resources/Project-Euler/001-multiples_of_3_and_5.py
Normal file
22
other_resources/Project-Euler/001-multiples_of_3_and_5.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
|
||||
def mul3and5(n):
|
||||
result = 0
|
||||
for num in range(1, n):
|
||||
if num%3 == 0 or num%5 == 0:
|
||||
result += num
|
||||
return result
|
||||
|
||||
|
||||
|
||||
def test_():
|
||||
assert(mul3and5(10) == 23)
|
||||
print(mul3and5(1000))
|
||||
print('Tests Passed!')
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_()
|
||||
|
18
other_resources/Project-Euler/002-even_fib_num.py
Normal file
18
other_resources/Project-Euler/002-even_fib_num.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
|
||||
def even_fib_num(limit):
|
||||
a, b = 0, 1
|
||||
while a < limit:
|
||||
yield a
|
||||
a, b = b, a + b
|
||||
|
||||
def main():
|
||||
print(sum(n for n in even_fib_num(4e6) if not (n & 1)))
|
||||
print('Tests Passed!')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
41
other_resources/Project-Euler/003-largest_prime_factor.py
Normal file
41
other_resources/Project-Euler/003-largest_prime_factor.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/python3
|
||||
#!/usr/bin/python3
|
||||
|
||||
def is_prime(n):
|
||||
if n < 4 : return True
|
||||
for i in range(2, int(n**0.5 + 1)):
|
||||
if not n%i: return False
|
||||
return True
|
||||
|
||||
|
||||
def largest_prime_factor(n):
|
||||
i = int(n**0.5 +1)
|
||||
while i > 1 :
|
||||
if not n%i and i&1:
|
||||
if is_prime(i): return i
|
||||
i -= 1
|
||||
return None
|
||||
|
||||
|
||||
def largest_prime_factor_optimized(n):
|
||||
factor = 2
|
||||
lastfactor = 1
|
||||
while n > 1:
|
||||
if not n%factor:
|
||||
lastfactor = factor
|
||||
n = n//factor
|
||||
while n%factor == 0:
|
||||
n = n//factor
|
||||
factor += 1
|
||||
return lastfactor
|
||||
|
||||
|
||||
def test_largest_prime_factor():
|
||||
assert(largest_prime_factor(13195)== 29)
|
||||
print(largest_prime_factor(600851475143))
|
||||
assert(largest_prime_factor_optimized(13195) == 29)
|
||||
print(largest_prime_factor_optimized(600851475143))
|
||||
print('Tests Passed!')
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_largest_prime_factor()
|
47
other_resources/Project-Euler/004-larg_palindrome.py
Normal file
47
other_resources/Project-Euler/004-larg_palindrome.py
Normal file
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
|
||||
|
||||
def is_palindrome(s):
|
||||
return s == reverse(s)
|
||||
|
||||
def reverse(s):
|
||||
rev = 0
|
||||
while s > 0:
|
||||
rev = 10*rev + s%10
|
||||
s = s//10
|
||||
return rev
|
||||
|
||||
|
||||
def is_palindrome_2(s):
|
||||
# to use it you need to cast str() first
|
||||
while s:
|
||||
if s[0] != s[-1]: return False
|
||||
else:
|
||||
s = s[1:-1]
|
||||
is_palindrome(s)
|
||||
return True
|
||||
|
||||
|
||||
def larg_palind_product(n):
|
||||
nmax, largpal = 9, 0
|
||||
for i in range(1, n):
|
||||
nmax += 9*10**i
|
||||
for i in range(nmax, nmax//2, -1):
|
||||
for j in range(i -1, (i -1)//2, -1):
|
||||
candidate = i*j
|
||||
if is_palindrome(candidate) and candidate > largpal:
|
||||
largpal = candidate
|
||||
return largpal
|
||||
|
||||
|
||||
def test_larg_palind_product():
|
||||
assert(larg_palind_product(2)== 9009)
|
||||
print(larg_palind_product(3))
|
||||
print('Tests Passed!')
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_larg_palind_product()
|
||||
|
32
other_resources/Project-Euler/005-smallest_multiple.py
Normal file
32
other_resources/Project-Euler/005-smallest_multiple.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
def smallest_multiple(n):
|
||||
set1 = set([x for x in range(1, n+1)])
|
||||
set2 = set()
|
||||
for i in range(len(set1), 0, -1):
|
||||
for j in range(1, i):
|
||||
if i%j == 0:
|
||||
set2.add(j)
|
||||
set1 = set1 - set2
|
||||
res_num = n*n
|
||||
while True:
|
||||
for i in set1:
|
||||
missing_div = False
|
||||
if res_num%i:
|
||||
missing_div = True
|
||||
shift = res_num%i
|
||||
break
|
||||
if not missing_div: return res_num
|
||||
res_num += 1 or shift
|
||||
shift = 0
|
||||
|
||||
|
||||
|
||||
|
||||
def test_():
|
||||
assert(smallest_multiple(10) == 2520)
|
||||
print(smallest_multiple(20))
|
||||
print('Tests Passed!')
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_()
|
21
other_resources/Project-Euler/006-sum_square_diff.py
Normal file
21
other_resources/Project-Euler/006-sum_square_diff.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
|
||||
def sum_square_diff(n):
|
||||
sq_sum, sum_sq = 0, 0
|
||||
for i in range(1, n+1):
|
||||
sum_sq += i**2
|
||||
sq_sum += i
|
||||
sq_sum = sq_sum **2
|
||||
return sq_sum - sum_sq
|
||||
|
||||
def main():
|
||||
assert(sum_square_diff(10) == 2640)
|
||||
print(sum_square_diff(100))
|
||||
print('Tests Passed!')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
32
other_resources/Project-Euler/007-findstprime.py
Normal file
32
other_resources/Project-Euler/007-findstprime.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
import math
|
||||
|
||||
def is_prime(number, prime_set):
|
||||
if number in prime_set: return True
|
||||
for i in range(2, int(math.sqrt(number)) + 1):
|
||||
if not number%i: return False
|
||||
return True
|
||||
|
||||
|
||||
def findstprime(n):
|
||||
count = 0
|
||||
candidate = 1
|
||||
prime_set = set()
|
||||
while count < n:
|
||||
candidate +=1
|
||||
if is_prime(candidate, prime_set):
|
||||
prime_set.add(candidate)
|
||||
count += 1
|
||||
return candidate
|
||||
|
||||
def main():
|
||||
assert(findstprime(6 == 13))
|
||||
print(findstprime(10001))
|
||||
print('Tests Passed!')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
28
other_resources/Project-Euler/008-largest_product_seq.py
Normal file
28
other_resources/Project-Euler/008-largest_product_seq.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
|
||||
|
||||
def largest_prod_seq(n):
|
||||
result = 0
|
||||
for i in range(0, len(n)-4):
|
||||
first = int(n[i])
|
||||
second = int(n[i+1])
|
||||
third = int(n[i+2])
|
||||
fourth = int(n[i+3])
|
||||
fifth = int(n[i+4])
|
||||
result_here = first*second*third*fourth*fifth
|
||||
if result < result_here:
|
||||
result = result_here
|
||||
return result
|
||||
|
||||
|
||||
def main():
|
||||
n = '7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450'
|
||||
print(largest_prod_seq(n))
|
||||
print('Tests Passed!')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
26
other_resources/Project-Euler/009-special_pyt.py
Normal file
26
other_resources/Project-Euler/009-special_pyt.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
|
||||
|
||||
def special_pyt(n):
|
||||
for i in range(3, n):
|
||||
for j in range(i+1, n):
|
||||
c = calc_c(i,j)
|
||||
if i + j + c == n:
|
||||
return i*j*c
|
||||
|
||||
def calc_c(a, b):
|
||||
return (a**2 + b**2)**0.5
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
assert(special_pyt(3+4+5) == (3*4*5))
|
||||
print(special_pyt(1000))
|
||||
print('Tests Passed!')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
24
other_resources/Project-Euler/010-summation_primes.py
Normal file
24
other_resources/Project-Euler/010-summation_primes.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
from findstprime import is_prime
|
||||
|
||||
def summation_primes(n):
|
||||
candidate = 2
|
||||
prime_set = set()
|
||||
while candidate < n:
|
||||
if is_prime(candidate, prime_set):
|
||||
prime_set.add(candidate)
|
||||
candidate +=1
|
||||
return sum(prime_set)
|
||||
|
||||
|
||||
def main():
|
||||
assert(summation_primes(10) == 17)
|
||||
print(summation_primes(2000000))
|
||||
print('Tests Passed!')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
66
other_resources/Project-Euler/011-larg_prod_grid.py
Normal file
66
other_resources/Project-Euler/011-larg_prod_grid.py
Normal file
|
@ -0,0 +1,66 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
import string
|
||||
|
||||
def get_grid(filename):
|
||||
grid = [ [ 0 for i in range(20) ] for j in range(20) ]
|
||||
with open(filename) as file:
|
||||
for row, line in enumerate(file):
|
||||
line.strip('\n')
|
||||
for collumn, number in enumerate(line.split(' ')):
|
||||
grid[row][collumn] = int(number)
|
||||
return grid
|
||||
|
||||
|
||||
def larg_prod_grid(grid):
|
||||
row, col, larg_prod = 0, 0, 0
|
||||
up, down, left, right, diag1, diag2, diag3, diag4 = 0, 0, 0, 0, 0, 0, 0, 0
|
||||
while row < len(grid):
|
||||
while col < len(grid[0]):
|
||||
if col > 2:
|
||||
up = grid[row][col] * grid[row][col-1] * grid[row][col-2] * grid[row][col-3]
|
||||
if col < len(grid[0]) - 3:
|
||||
down = grid[row][col] * grid[row][col+1] * grid[row][col+2] * grid[row][col+3]
|
||||
if row > 2:
|
||||
left = grid[row][col] * grid[row-1][col] * grid[row-2][col] * grid[row-3][col]
|
||||
if row < len(grid) - 3:
|
||||
right = grid[row][col] * grid[row+1][col] * grid[row+2][col] * grid[row+3][col]
|
||||
|
||||
if col > 2 and row > 2:
|
||||
diag1 = grid[row][col] * grid[row-1][col-1] * grid[row-2][col-2] * grid[row-3][col-3]
|
||||
if col > 2 and row < len(grid) - 3:
|
||||
diag2 = grid[row][col] * grid[row+1][col-1] * grid[row+2][col-2] * grid[row+3][col-3]
|
||||
|
||||
if col < len(grid[0]) - 3 and row > 2:
|
||||
diag3 = grid[row][col] * grid[row-1][col+1] * grid[row-2][col+2] * grid[row-3][col+3]
|
||||
if col < len(grid[0]) -3 and row < len(grid) - 3:
|
||||
down = grid[row][col] * grid[row+1][col+1] * grid[row+1][col+2] * grid[row+1][col+3]
|
||||
|
||||
l1 = [up, down, left, right, diag1, diag2, diag3, diag4]
|
||||
largest_prod_here = max(l1)
|
||||
if largest_prod_here > larg_prod:
|
||||
larg_prod = largest_prod_here
|
||||
col += 1
|
||||
col = 0
|
||||
row += 1
|
||||
|
||||
return larg_prod
|
||||
|
||||
|
||||
def main():
|
||||
import time
|
||||
start = time.time()
|
||||
|
||||
filename = 'larg_prod_grid.dat'
|
||||
grid = get_grid(filename)
|
||||
assert((grid[6][8], grid[7][9], grid[8][10], grid[9][11]) == (26, 63, 78, 14))
|
||||
print(larg_prod_grid(grid))
|
||||
|
||||
elapsed = (time.time() - start)
|
||||
print('Tests Passed!\n It took %s seconds to run them.' % (elapsed))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
import math
|
||||
|
||||
def find_div(n):
|
||||
''' find the divisor of a given n'''
|
||||
set_div = {1, n}
|
||||
for i in range(2, int(math.sqrt(n))+ 1):
|
||||
if not n % i:
|
||||
set_div.add(i)
|
||||
set_div.add(n//i)
|
||||
l1 = list(set_div)
|
||||
return len(l1)
|
||||
|
||||
|
||||
def find_trian(l):
|
||||
''' find the lth trian number'''
|
||||
return sum(range(1, l+1))
|
||||
|
||||
|
||||
def highly_divisible_trian_num(d):
|
||||
thtriangle, n_div, count = 1, 0, 1
|
||||
while n_div < d:
|
||||
count += 1
|
||||
thtriangle += count
|
||||
n_div = find_div(thtriangle)
|
||||
return (thtriangle, count)
|
||||
|
||||
|
||||
def main():
|
||||
import time
|
||||
start = time.time()
|
||||
assert(highly_divisible_trian_num(6) == (28, 7))
|
||||
print(highly_divisible_trian_num(500))
|
||||
|
||||
elapsed = (time.time() - start)
|
||||
print('Tests Passed!\n It took %s seconds to run them.' % (elapsed))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
25
other_resources/Project-Euler/013-large_sum.py
Normal file
25
other_resources/Project-Euler/013-large_sum.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
def large_sum(filename):
|
||||
sum_total, lines, numbers = 0, 0, 0
|
||||
with open(filename) as file:
|
||||
for line in file:
|
||||
sum_total += int(line.strip('\n'))
|
||||
return str(sum_total)[0:10]
|
||||
|
||||
|
||||
def main():
|
||||
import time
|
||||
start = time.time()
|
||||
|
||||
filename = 'large_sum.dat'
|
||||
print(large_sum(filename))
|
||||
|
||||
elapsed = (time.time() - start)
|
||||
print('Tests Passed!\n It took %s seconds to run them.' % (elapsed))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
43
other_resources/Project-Euler/014-long_collatz_seq.py
Normal file
43
other_resources/Project-Euler/014-long_collatz_seq.py
Normal file
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
def find_coll_seq(n):
|
||||
count = 1
|
||||
while n > 1:
|
||||
if n%2 == 0:
|
||||
n = n//2
|
||||
else:
|
||||
n = 3*n +1
|
||||
count += 1
|
||||
return count
|
||||
|
||||
|
||||
def find_longest_chain(limit):
|
||||
longest, number = 0, 0
|
||||
start = 0
|
||||
while start <= limit:
|
||||
size_chain = find_coll_seq(start)
|
||||
if size_chain > longest:
|
||||
longest = size_chain
|
||||
number = start
|
||||
start += 1
|
||||
|
||||
return (longest, number)
|
||||
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
import time
|
||||
start = time.time()
|
||||
|
||||
#print(find_longest_chain(13))
|
||||
print(find_longest_chain(10**6))
|
||||
|
||||
elapsed = (time.time() - start)
|
||||
print('Tests Passed!\n It took %s seconds to run them.' % (elapsed))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
42
other_resources/Project-Euler/015-lattice_paths.py
Normal file
42
other_resources/Project-Euler/015-lattice_paths.py
Normal file
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
def lattice_paths(squares):
|
||||
gridsize = squares+1
|
||||
grid = [[0 for i in range(gridsize)] for j in range(gridsize)]
|
||||
row, col = 0, 0
|
||||
|
||||
while col < gridsize:
|
||||
while row < gridsize:
|
||||
|
||||
if row == 0 and col == 0:
|
||||
grid[row][col] = 1
|
||||
|
||||
else:
|
||||
if row == 0 and col != 0:
|
||||
grid[row][col] += grid[row][col-1]
|
||||
elif row != 0 and col == 0:
|
||||
grid[row][col] += grid[row-1][col]
|
||||
else:
|
||||
grid[row][col] += grid[row][col-1] + grid[row-1][col]
|
||||
|
||||
row += 1
|
||||
row = 0
|
||||
col += 1
|
||||
return grid[gridsize-1][gridsize-1]
|
||||
|
||||
|
||||
def main():
|
||||
import time
|
||||
start = time.time()
|
||||
|
||||
assert(lattice_paths(2) == 6)
|
||||
print(lattice_paths(20))
|
||||
|
||||
elapsed = (time.time() - start)
|
||||
print('Tests Passed!\n It took %s seconds to run them.' % (elapsed))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
22
other_resources/Project-Euler/016-power_digit_sum.py
Normal file
22
other_resources/Project-Euler/016-power_digit_sum.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
|
||||
def power_digit_sum(n):
|
||||
number = str(2**n)
|
||||
sum_res = 0
|
||||
for i in number:
|
||||
sum_res += int(i)
|
||||
return sum_res
|
||||
|
||||
|
||||
|
||||
def test_():
|
||||
assert(power_digit_sum(15) == 26)
|
||||
print(power_digit_sum(1000))
|
||||
print('Tests Passed!')
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_()
|
||||
|
63
other_resources/Project-Euler/017-number_letter_counts.py
Normal file
63
other_resources/Project-Euler/017-number_letter_counts.py
Normal file
|
@ -0,0 +1,63 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
|
||||
|
||||
def number_letter_counts(n):
|
||||
dict_lett = build_dict(n)
|
||||
sum_letter = 0
|
||||
for item in dict_lett:
|
||||
sum_letter += dict_lett[item]
|
||||
return sum_letter
|
||||
|
||||
|
||||
def build_dict(n):
|
||||
lett_dict = {}
|
||||
numbers = (x for x in range(1, n+1))
|
||||
dec = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen']
|
||||
ties = ['twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety']
|
||||
|
||||
for number in numbers:
|
||||
if 1 <= number < 20:
|
||||
lett_dict[number] = len(dec[number-1])
|
||||
elif 20 <= number < 100:
|
||||
index_dec = number//10
|
||||
index_num = number%10
|
||||
if index_num == 0:
|
||||
lett_dict[number] = len(ties[index_dec-2])
|
||||
else:
|
||||
lett_dict[number] = len(ties[index_dec-2]) + len(dec[index_num-1])
|
||||
elif 100 <= number < 1000:
|
||||
index_hun = number//100
|
||||
index_dec = number%100
|
||||
if index_dec == 0:
|
||||
lett_dict[number] = len(dec[index_hun-1]) + len('hundred')
|
||||
else:
|
||||
if 1 <= index_dec < 20:
|
||||
lett_dict[number] = len(dec[index_hun-1]) + len('hundred') + len('and') + len(dec[index_dec-1])
|
||||
elif 20 <= index_dec < 100:
|
||||
index_dec2 = index_dec//10
|
||||
index_num = index_dec%10
|
||||
if index_num == 0:
|
||||
lett_dict[number] = len(dec[index_hun-1]) + len('hundred') + len('and') + len(ties[index_dec2-2])
|
||||
else:
|
||||
lett_dict[number] = len(dec[index_hun-1]) + len('hundred') + len('and') + len(ties[index_dec2-2]) + len(dec[index_num-1])
|
||||
elif number == 1000:
|
||||
lett_dict[number] = len('onethousand')
|
||||
|
||||
return lett_dict
|
||||
|
||||
|
||||
def main():
|
||||
import time
|
||||
start = time.time()
|
||||
|
||||
assert(number_letter_counts(5) == 19)
|
||||
print(number_letter_counts(1000))
|
||||
elapsed = (time.time() - start)
|
||||
print('Tests Passed!\n It took %s seconds to run them.' % (elapsed))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
55
other_resources/Project-Euler/018-max_path_sum.py
Normal file
55
other_resources/Project-Euler/018-max_path_sum.py
Normal file
|
@ -0,0 +1,55 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
def max_path_sum(t):
|
||||
root = t[0][0]
|
||||
height, width, index, large_num = 1, 0, 0, 0
|
||||
max_sum = root
|
||||
heights = len(t[:])
|
||||
|
||||
while height < heights:
|
||||
values_here = t[height][index:index+2]
|
||||
if values_here[0] > values_here[1]:
|
||||
large_num = values_here[0]
|
||||
else:
|
||||
large_num = values_here[1]
|
||||
index += 1
|
||||
max_sum += large_num
|
||||
pivot = large_num
|
||||
width, large_num = 0, 0
|
||||
height += 1
|
||||
|
||||
return max_sum
|
||||
|
||||
def edit_input(filename):
|
||||
output = []
|
||||
with open(filename) as file:
|
||||
for line in file:
|
||||
line = line.rstrip('\n')
|
||||
output.append(line.split(' '))
|
||||
for i, l1 in enumerate(output):
|
||||
for j, c in enumerate(output[i]):
|
||||
output[i][j] = int(c)
|
||||
return(output)
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
import time
|
||||
start = time.time()
|
||||
|
||||
filename = 'max_path_sum0.dat'
|
||||
t1 = edit_input(filename)
|
||||
print('Little pir: ',max_path_sum(t1))
|
||||
|
||||
filename = 'max_path_sum.dat'
|
||||
t2 = edit_input(filename)
|
||||
print('Big pir: ', max_path_sum(t2))
|
||||
|
||||
elapsed = (time.time() - start)
|
||||
print('Tests Passed!\n It took %s seconds to run them.' % (elapsed))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
65
other_resources/Project-Euler/019-counting_sundays.py
Normal file
65
other_resources/Project-Euler/019-counting_sundays.py
Normal file
|
@ -0,0 +1,65 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
'''
|
||||
1 Jan 1900 was a Monday.
|
||||
Thirty days has September,
|
||||
April, June and November.
|
||||
All the rest have thirty-one,
|
||||
Saving February alone,
|
||||
Which has twenty-eight, rain or shine.
|
||||
And on leap years, twenty-nine.
|
||||
A leap year occurs on any year evenly divisible by 4, but not on a century unless it is divisible by 400.
|
||||
How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?
|
||||
'''
|
||||
|
||||
|
||||
def find_if_leap_year(y):
|
||||
if (y%4 == 0 and y%100 != 0) or (y%400 == 0):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def counting_sundays():
|
||||
''' define variables '''
|
||||
days_year = 7*31 + 4*30 + 28
|
||||
count_sundays = 0
|
||||
days_week = 7
|
||||
dict_week = {0: 'mon', 1:'tue', 2:'wed', 3:'thu', 4:'fri', 5:'sat', 6:'sun'}
|
||||
|
||||
|
||||
''' with info from 1900 find first day for 1901 '''
|
||||
first_day = days_year%days_week # not a leap year
|
||||
|
||||
for y in range (1901, 2001):
|
||||
leap_year = find_if_leap_year(y)
|
||||
days_count = first_day
|
||||
|
||||
for m in range(1, 13):
|
||||
if days_count%7 == 6:
|
||||
count_sundays += 1
|
||||
if m == 2:
|
||||
if leap_year:
|
||||
days_count += 29
|
||||
else:
|
||||
days_count += 28
|
||||
elif m == 4 or m == 6 or m == 9 or m == 11:
|
||||
days_count += 30
|
||||
else:
|
||||
days_count += 31
|
||||
|
||||
if leap_year: first_day = (first_day +2)%days_week
|
||||
else: first_day = (first_day +1)%days_week
|
||||
|
||||
return count_sundays
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
print(counting_sundays())
|
||||
print('Tests Passed!')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
32
other_resources/Project-Euler/020-factorial.py
Normal file
32
other_resources/Project-Euler/020-factorial.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
def factorial(n):
|
||||
prod = 1
|
||||
for i in range(1,n):
|
||||
prod *= i
|
||||
return prod
|
||||
|
||||
def find_sum(n):
|
||||
sum_ = 0
|
||||
fact = factorial(n)
|
||||
number = str(fact)
|
||||
for i in number:
|
||||
sum_ += int(i)
|
||||
return sum_
|
||||
|
||||
|
||||
def main():
|
||||
import time
|
||||
start = time.time()
|
||||
|
||||
assert(find_sum(10) == 27)
|
||||
print(find_sum(100))
|
||||
|
||||
elapsed = (time.time() - start)
|
||||
print('Tests Passed!\n It took %s seconds to run them.' % (elapsed))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
44
other_resources/Project-Euler/021-amicable_numbers.py
Normal file
44
other_resources/Project-Euler/021-amicable_numbers.py
Normal file
|
@ -0,0 +1,44 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
'''
|
||||
Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n).
|
||||
If d(a) = b and d(b) = a, where a b, then a and b are an amicable pair and each of a and b are called amicable numbers.
|
||||
|
||||
For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110; therefore d(220) = 284. The proper divisors of 284 are 1, 2, 4, 71 and 142; so d(284) = 220.
|
||||
|
||||
Evaluate the sum of all the amicable numbers under 10000.
|
||||
'''
|
||||
|
||||
def find_sum_proper_divisors(n):
|
||||
sum_proper_div = 0
|
||||
for i in range(1, n):
|
||||
if n%i == 0:
|
||||
sum_proper_div += i
|
||||
return sum_proper_div
|
||||
|
||||
|
||||
def amicable_numbers(N):
|
||||
sum_div_list = [find_sum_proper_divisors(i) for i in range(1, N+1)]
|
||||
sum_amicable_numbers = 0
|
||||
set_div = set()
|
||||
for a in range(1, N):
|
||||
da = sum_div_list[a-1]
|
||||
if da < N:
|
||||
b = da
|
||||
db = sum_div_list[b-1]
|
||||
if a != b and db == a and a not in set_div and b not in set_div:
|
||||
sum_amicable_numbers += a + b
|
||||
set_div.add(a)
|
||||
set_div.add(b)
|
||||
return sum_amicable_numbers
|
||||
|
||||
|
||||
def main():
|
||||
print(amicable_numbers(10000))
|
||||
print('Tests Passed!')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
33
other_resources/Project-Euler/022-names_score.py
Normal file
33
other_resources/Project-Euler/022-names_score.py
Normal file
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
|
||||
def calculate_score(name, dict_letters):
|
||||
sum_letters = 0
|
||||
for letter in name:
|
||||
sum_letters += dict_letters[letter]
|
||||
return sum_letters
|
||||
|
||||
def names_score(filename):
|
||||
dict_letters ={'A':1,'B':2,'C':3,'D':4,'E':5,'F':6,'G':7,'H':8,'I':9,'J':10,'K':11,'L':12,'M':13,'N':14,'O':15,'P':16,'Q':17,'R':18,'S':19, 'T':20,'U':21,'V':22,'W':23,'X':24,'Y':25,'Z':26}
|
||||
total_score = 0
|
||||
with open(filename) as file:
|
||||
for line in file:
|
||||
names = [name.strip('"') for name in line.split(',')]
|
||||
names.sort()
|
||||
for i, name in enumerate(names):
|
||||
total_score += (i+1)* calculate_score(name, dict_letters)
|
||||
|
||||
return total_score
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
filename = 'names.txt'
|
||||
print(names_score(filename))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
44
other_resources/Project-Euler/023-non_abund_sums.py
Normal file
44
other_resources/Project-Euler/023-non_abund_sums.py
Normal file
|
@ -0,0 +1,44 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
def find_sum_proper_div(n):
|
||||
sum_proper_div = 0
|
||||
for i in range(1, n):
|
||||
if n%i == 0:
|
||||
sum_proper_div += i
|
||||
return sum_proper_div
|
||||
|
||||
|
||||
def find_all_abund(n):
|
||||
sum_div_list = [find_sum_proper_div(i) for i in range(n)]
|
||||
abu = set()
|
||||
for i in range(n):
|
||||
if i < sum_div_list[i]:
|
||||
abu.add(i)
|
||||
return abu
|
||||
|
||||
|
||||
def non_abund_sums(n):
|
||||
abu = find_all_abund(n)
|
||||
sum_nom_abu = 0
|
||||
|
||||
for i in range(n):
|
||||
if not any( (i-a in abu) for a in abu):
|
||||
sum_nom_abu += i
|
||||
|
||||
return sum_nom_abu
|
||||
|
||||
|
||||
def test_():
|
||||
r = set([i for i in range(25)])
|
||||
r_abu = {24}
|
||||
r = r - r_abu
|
||||
assert(non_abund_sums(25) == sum(r))
|
||||
print(non_abund_sums(28123))
|
||||
print('Tests Passed!')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_()
|
||||
|
33
other_resources/Project-Euler/024-lexico_per.py
Normal file
33
other_resources/Project-Euler/024-lexico_per.py
Normal file
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
def perm_item(elements):
|
||||
if len(elements) <= 1:
|
||||
yield elements
|
||||
else:
|
||||
for (index, elmt) in enumerate(elements):
|
||||
other_elmts = elements[:index]+elements[index+1:]
|
||||
for permutation in perm_item(other_elmts):
|
||||
yield [elmt] + permutation
|
||||
|
||||
|
||||
def lex_perm(l1, n):
|
||||
perm_list = list(perm_item(l1))
|
||||
return sorted(perm_list)[n-1]
|
||||
|
||||
|
||||
def main():
|
||||
import time
|
||||
start = time.time()
|
||||
|
||||
l1 = [0,1,2,3,4,5,6,7,8,9]
|
||||
n = 10**6
|
||||
print(lex_perm(l1, n))
|
||||
|
||||
elapsed = (time.time() - start)
|
||||
print('Tests Passed!\n It took %s seconds to run them.' % (elapsed))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
63
other_resources/Project-Euler/025-100-digit-fib.py
Normal file
63
other_resources/Project-Euler/025-100-digit-fib.py
Normal file
|
@ -0,0 +1,63 @@
|
|||
#!/usr/bin/python3
|
||||
# mari wahl @2014
|
||||
# marina.w4hl at gmail
|
||||
#
|
||||
|
||||
'''
|
||||
The Fibonacci sequence is defined by the recurrence relation:
|
||||
Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1.
|
||||
Hence the first 12 terms will be:
|
||||
|
||||
F1 = 1
|
||||
F2 = 1
|
||||
F3 = 2
|
||||
F4 = 3
|
||||
F5 = 5
|
||||
F6 = 8
|
||||
F7 = 13
|
||||
F8 = 21
|
||||
F9 = 34
|
||||
F10 = 55
|
||||
F11 = 89
|
||||
F12 = 144
|
||||
The 12th term, F12, is the first term to contain three digits.
|
||||
|
||||
What is the first term in the Fibonacci sequence to contain 1000 digits?
|
||||
Answer: 4782
|
||||
'''
|
||||
|
||||
|
||||
def fib(num=1, num_before=1):
|
||||
found = False
|
||||
|
||||
num_before, num = num, num + num_before
|
||||
|
||||
if count_digits(num) == 1000: found = True
|
||||
|
||||
return num, num_before, found
|
||||
|
||||
|
||||
|
||||
def count_digits(num):
|
||||
num_str = str(num)
|
||||
return len(num_str)
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
found = False
|
||||
num = 1
|
||||
num_before = 1
|
||||
count = 2
|
||||
|
||||
while not found:
|
||||
num, num_before, found = fib(num, num_before)
|
||||
count +=1
|
||||
|
||||
print(count)
|
||||
print('Done!')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
40
other_resources/Project-Euler/026-reciprocal-cycles.py
Normal file
40
other_resources/Project-Euler/026-reciprocal-cycles.py
Normal file
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/python3
|
||||
# mari wahl @2014
|
||||
# marina.w4hl at gmail
|
||||
|
||||
|
||||
'''
|
||||
A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given:
|
||||
|
||||
1/2 = 0.5
|
||||
1/3 = 0.(3)
|
||||
1/4 = 0.25
|
||||
1/5 = 0.2
|
||||
1/6 = 0.1(6)
|
||||
1/7 = 0.(142857)
|
||||
1/8 = 0.125
|
||||
1/9 = 0.(1)
|
||||
1/10 = 0.1
|
||||
Where 0.1(6) means 0.166666..., and has a 1-digit recurring cycle. It can be seen that 1/7 has a 6-digit recurring cycle.
|
||||
|
||||
Find the value of d < 1000 for which 1/d contains the longest recurring cycle in its decimal fraction part.
|
||||
|
||||
Answer: 983
|
||||
'''
|
||||
|
||||
|
||||
def recurring_cycle(n, d):
|
||||
for dd in range(1, d):
|
||||
if 1 == 10**dd % d:
|
||||
return dd
|
||||
return 0
|
||||
|
||||
def main():
|
||||
n = 1
|
||||
limit = 1000
|
||||
longest = max(recurring_cycle(n, i) for i in range(2, limit+1))
|
||||
print [i for i in range(2, limit+1) if recurring_cycle(n, i) == longest][0]
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
50
other_resources/Project-Euler/027-quad_primes.py
Normal file
50
other_resources/Project-Euler/027-quad_primes.py
Normal file
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
def quad_form(n, a, b):
|
||||
return n**2 + a*n + b
|
||||
|
||||
def isPrime(n):
|
||||
n = abs(int(n))
|
||||
if n < 2:
|
||||
return False
|
||||
if n == 2:
|
||||
return True
|
||||
if not n & 1:
|
||||
return False
|
||||
for x in range(3, int(n**0.5)+1, 2):
|
||||
if n % x == 0:
|
||||
return False
|
||||
return True
|
||||
|
||||
def quad_primes(a, b):
|
||||
count_max = 0
|
||||
coef = ()
|
||||
for aa in range(-a, a):
|
||||
for bb in range(-b, b):
|
||||
n = 0
|
||||
while True:
|
||||
number = quad_form(n, aa, bb)
|
||||
if isPrime(number):
|
||||
n += 1
|
||||
else:
|
||||
if n > count_max:
|
||||
count_max = n
|
||||
coef = (aa, bb)
|
||||
break
|
||||
return coef(0)*coef(1), coef
|
||||
|
||||
|
||||
def main():
|
||||
import time
|
||||
start = time.time()
|
||||
|
||||
print(quad_primes(1000, 1000))
|
||||
|
||||
elapsed = (time.time() - start)
|
||||
print('Tests Passed!\n It took %s seconds to run them.' % (elapsed))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
39
other_resources/Project-Euler/028-number_spiral.py
Normal file
39
other_resources/Project-Euler/028-number_spiral.py
Normal file
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
def number_spiral(spiral):
|
||||
|
||||
|
||||
return rows, mid
|
||||
|
||||
def make_spiral(n):
|
||||
spiral = []
|
||||
row = rows//2
|
||||
col = col//2
|
||||
count = 1
|
||||
while row < n:
|
||||
while col < n:
|
||||
spiral[col][row] = count
|
||||
count += 1
|
||||
if count%2 == 0:
|
||||
col += 1
|
||||
else:
|
||||
row += 1
|
||||
|
||||
return spiral
|
||||
|
||||
def main():
|
||||
import time
|
||||
start = time.time()
|
||||
|
||||
n = 5
|
||||
spiral = make_spiral(n)
|
||||
print(number_spiral(spiral))# 101
|
||||
|
||||
elapsed = (time.time() - start)
|
||||
print('Tests Passed!\n It took %s seconds to run them.' % (elapsed))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
27
other_resources/Project-Euler/029-dist_pow.py
Normal file
27
other_resources/Project-Euler/029-dist_pow.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
def dist_pow(a1, a2, b1, b2):
|
||||
set1 = set()
|
||||
for a in range(a1, a2 + 1):
|
||||
for b in range(b1, b2 + 1):
|
||||
set1.add(a**b)
|
||||
return len(set1)
|
||||
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
import time
|
||||
start = time.time()
|
||||
|
||||
print(dist_pow(2, 5, 2, 5))
|
||||
print(dist_pow(2, 100, 2, 100))
|
||||
|
||||
elapsed = (time.time() - start)
|
||||
print('Tests Passed!\n It took %s seconds to run them.' % (elapsed))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
30
other_resources/Project-Euler/030-digit_fifth_pow.py
Normal file
30
other_resources/Project-Euler/030-digit_fifth_pow.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
def digit_fifth_pow(n):
|
||||
lnum = []
|
||||
for num in range(10**(2), 10**(n+2)):
|
||||
sum_here = 0
|
||||
num_str = str(num)
|
||||
for i in num_str:
|
||||
num_int = int(i)
|
||||
num_int_pow = num_int**n
|
||||
sum_here += num_int_pow
|
||||
if sum_here == num:
|
||||
lnum.append(num)
|
||||
return lnum, sum(lnum)
|
||||
|
||||
|
||||
def main():
|
||||
import time
|
||||
start = time.time()
|
||||
|
||||
print(digit_fifth_pow(5))
|
||||
|
||||
elapsed = (time.time() - start)
|
||||
print('Tests Passed!\n It took %s seconds to run them.' % (elapsed))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
28
other_resources/Project-Euler/031-coin_sums.py
Normal file
28
other_resources/Project-Euler/031-coin_sums.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/python3
|
||||
# mari wahl @2014
|
||||
# marina.w4hl at gmail
|
||||
'''
|
||||
In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:
|
||||
|
||||
1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).
|
||||
It is possible to make £2 in the following way:
|
||||
|
||||
1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p
|
||||
How many different ways can £2 be made using any number of coins?
|
||||
'''
|
||||
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
import time
|
||||
start = time.time()
|
||||
|
||||
print(digit_fifth_pow(5))
|
||||
|
||||
elapsed = (time.time() - start)
|
||||
print('Tests Passed!\n It took %s seconds to run them.' % (elapsed))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
51
other_resources/Project-Euler/032-pandigital.py
Normal file
51
other_resources/Project-Euler/032-pandigital.py
Normal file
|
@ -0,0 +1,51 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
|
||||
__author__ = "Mari Wahl"
|
||||
__email__ = "marina.w4hl@gmail.com"
|
||||
|
||||
'''
|
||||
We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly once; for example, the 5-digit number, 15234, is 1 through 5 pandigital.
|
||||
The product 7254 is unusual, as the identity, 39 x 186 = 7254, containing multiplicand, multiplier, and product is 1 through 9 pandigital.
|
||||
Find the sum of all products whose multiplicand/multiplier/product identity can be written as a 1 through 9 pandigital.
|
||||
'''
|
||||
|
||||
|
||||
|
||||
def isPandigitalString(string):
|
||||
""" Check if string contains a pandigital number. """
|
||||
digits = len(string)
|
||||
|
||||
if digits >= 10:
|
||||
return False
|
||||
|
||||
for i in range(1,digits+1):
|
||||
if str(i) not in string:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
|
||||
def gives9PandigitalProduct(a, b):
|
||||
numbers = str(a) + str(b) + str(a*b)
|
||||
if len(numbers) != 9:
|
||||
return False
|
||||
return isPandigitalString(numbers)
|
||||
|
||||
|
||||
def main():
|
||||
products = []
|
||||
|
||||
for a in range(0, 100000):
|
||||
for b in range(a, 100000):
|
||||
if len(str(a*b) + str(a) + str(b)) > 9:
|
||||
break
|
||||
if gives9PandigitalProduct(a, b):
|
||||
products.append(a*b)
|
||||
print("%i x %i = %i" % (a, b, a*b))
|
||||
|
||||
print(sum(set(products)))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
91
other_resources/Project-Euler/035-circular_primes.py
Normal file
91
other_resources/Project-Euler/035-circular_primes.py
Normal file
|
@ -0,0 +1,91 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
def isPrime(n):
|
||||
n = abs(int(n))
|
||||
if n < 2:
|
||||
return False
|
||||
if n == 2:
|
||||
return True
|
||||
for x in range(2, int(n**0.5)+1):
|
||||
if n%x == 0:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def findPermutations(s):
|
||||
res = []
|
||||
if len(s) == 1:
|
||||
res.append(s)
|
||||
else:
|
||||
for i, c in enumerate(s):
|
||||
for perm in findPermutations(s[:i] + s[i+1:]):
|
||||
res.append(c + perm)
|
||||
return res
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def isCircular(n):
|
||||
n_str = str(n)
|
||||
permutations = findPermutations(n_str)
|
||||
for perm in permutations:
|
||||
if not isPrime(perm):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
|
||||
def generatePrimes(n):
|
||||
if n == 2: return [2]
|
||||
elif n < 2: return []
|
||||
s = [i for i in range(3, n+1, 2)]
|
||||
mroot = n ** 0.5
|
||||
half = (n+1)//2 - 1
|
||||
i, m = 0, 3
|
||||
while m <= mroot:
|
||||
if s[i]:
|
||||
j = (m*m-3)//2
|
||||
s[j] = 0
|
||||
while j < half:
|
||||
s[j] = 0
|
||||
j += m
|
||||
i = i+1
|
||||
m = 2*i+3
|
||||
return [2]+[x for x in s if x]
|
||||
|
||||
|
||||
def generate_n_Primes(n):
|
||||
primes = []
|
||||
chkthis = 2
|
||||
while len(primes) < n:
|
||||
ptest = [chkthis for i in primes if chkthis%i == 0]
|
||||
primes += [] if ptest else [chkthis]
|
||||
chkthis += 1
|
||||
return primes
|
||||
|
||||
|
||||
|
||||
def circular_primes(n):
|
||||
primes = generatePrimes(n)
|
||||
count = 0
|
||||
for prime in primes:
|
||||
if isCircular(prime):
|
||||
count += 1
|
||||
return count
|
||||
|
||||
|
||||
def main():
|
||||
import time
|
||||
start = time.time()
|
||||
|
||||
print(circular_primes(1000000))
|
||||
|
||||
elapsed = (time.time() - start)
|
||||
print('Tests Passed!\n It took %s seconds to run them.' % (elapsed))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
64
other_resources/Project-Euler/046-gold_other.py
Normal file
64
other_resources/Project-Euler/046-gold_other.py
Normal file
|
@ -0,0 +1,64 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
def isPrime(n):
|
||||
n = abs(int(n))
|
||||
if n < 2:
|
||||
return False
|
||||
if n == 2:
|
||||
return True
|
||||
if not n & 1:
|
||||
return False
|
||||
for x in range(3, int(n**0.5)+1, 2):
|
||||
if n % x == 0:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def generetePrimes(n):
|
||||
if n == 2: return [2]
|
||||
elif n < 2: return []
|
||||
s = [i for i in range(3, n+1,2)]
|
||||
mroot = n ** 0.5
|
||||
half = (n+1)//2-1
|
||||
i = 0
|
||||
m = 3
|
||||
while m <= mroot:
|
||||
if s[i]:
|
||||
j = (m*m - 3)//2
|
||||
s[j] = 0
|
||||
while j < half:
|
||||
s[j] = 0
|
||||
j += m
|
||||
i = i+1
|
||||
m = 2*i+3
|
||||
return [2]+[x for x in s if x]
|
||||
|
||||
|
||||
def gold_other(n):
|
||||
primes_for_n = generetePrimes(n)
|
||||
numbers = {prime + 2*x**2 for prime in primes_for_n for x in range(1, int(n**0.5))}
|
||||
conj = {x for x in range(3, n, 2) if not isPrime(x)}
|
||||
|
||||
while True:
|
||||
candidates = conj - numbers
|
||||
if not candidates:
|
||||
gold_other(2*n)
|
||||
else:
|
||||
return min(candidates)
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
import time
|
||||
start = time.time()
|
||||
|
||||
print(gold_other(10000))
|
||||
|
||||
elapsed = (time.time() - start)
|
||||
print('Tests Passed!\n It took %s seconds to run them.' % (elapsed))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
29
other_resources/Project-Euler/048-self_powers.py
Normal file
29
other_resources/Project-Euler/048-self_powers.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
def self_powers(power, digits):
|
||||
sum_total = 0
|
||||
for pow in range(1, power+1):
|
||||
sum_total += pow**pow
|
||||
sum_total_str = str(sum_total)
|
||||
last_digits = ''
|
||||
for i, c in enumerate(sum_total_str[-digits:]):
|
||||
last_digits += c
|
||||
return int(last_digits)
|
||||
|
||||
|
||||
def main():
|
||||
import time
|
||||
start = time.time()
|
||||
|
||||
|
||||
assert(self_powers(10, len('10405071317')) == 10405071317)
|
||||
print(self_powers(1000, 10))
|
||||
|
||||
elapsed = (time.time() - start)
|
||||
print('Tests Passed!\n It took %s seconds to run them.' % (elapsed))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
43
other_resources/Project-Euler/065-100th-e-numerator.py
Normal file
43
other_resources/Project-Euler/065-100th-e-numerator.py
Normal file
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
__author__ = "Mari Wahl"
|
||||
__email__ = "marina.w4hl@gmail.com"
|
||||
|
||||
'''
|
||||
e = [2; 1,2,1, 1,4,1, 1,6,1 , ... , 1,2k,1, ...].
|
||||
|
||||
The first ten terms in the sequence of convergents for e are:
|
||||
|
||||
2, 3, 8/3, 11/4, 19/7, 87/32, 106/39, 193/71, 1264/465, 1457/536, ...
|
||||
The sum of digits in the numerator of the 10th convergent is 1+4+5+7=17.
|
||||
|
||||
Find the sum of digits in the numerator of the 100th convergent of the continued fraction for e.
|
||||
'''
|
||||
|
||||
from itertools import islice
|
||||
|
||||
def take(iterable, n):
|
||||
#Make an iterator that returns selected elements from the iterable.
|
||||
return list(islice(iterable, n))
|
||||
|
||||
def e():
|
||||
yield 2
|
||||
k = 1
|
||||
while True:
|
||||
yield 1
|
||||
yield 2*k
|
||||
yield 1
|
||||
k += 1
|
||||
|
||||
def rationalize(frac):
|
||||
if len(frac) == 0:
|
||||
return (1, 0)
|
||||
elif len(frac) == 1:
|
||||
return (frac[0], 1)
|
||||
else:
|
||||
remainder = frac[1:len(frac)]
|
||||
(num, denom) = rationalize(remainder)
|
||||
return (frac[0] * num + denom, num)
|
||||
|
||||
numerator = rationalize(take(e(), 100))[0]
|
||||
print sum(int(d) for d in str(numerator))
|
52
other_resources/Project-Euler/089-roman_numbers.py
Normal file
52
other_resources/Project-Euler/089-roman_numbers.py
Normal file
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
__author__ = "Mari Wahl"
|
||||
__email__ = "marina.w4hl@gmail.com"
|
||||
|
||||
'''
|
||||
The rules for writing Roman numerals allow for many ways of writing each number (see About Roman Numerals...). However, there is always a "best" way of writing a particular number.
|
||||
|
||||
For example, the following represent all of the legitimate ways of writing the number sixteen:
|
||||
|
||||
IIIIIIIIIIIIIIII
|
||||
VIIIIIIIIIII
|
||||
VVIIIIII
|
||||
XIIIIII
|
||||
VVVI
|
||||
XVI
|
||||
|
||||
The last example being considered the most efficient, as it uses the least number of numerals.
|
||||
|
||||
The 11K text file, roman.txt (right click and 'Save Link/Target As...'), contains one thousand numbers written in valid, but not necessarily minimal, Roman numerals; that is, they are arranged in descending units and obey the subtractive pair rule (see About Roman Numerals... for the definitive rules for this problem).
|
||||
|
||||
Find the number of characters saved by writing each of these in their minimal form.
|
||||
'''
|
||||
|
||||
|
||||
|
||||
import os
|
||||
|
||||
def subtractive(roman):
|
||||
result = roman
|
||||
replacements = [
|
||||
("VIIII", "IX"),
|
||||
("IIII", "IV"),
|
||||
("LXXXX", "XC"),
|
||||
("XXXX", "XL"),
|
||||
("DCCCC", "CM"),
|
||||
("CCCC", "CD"),
|
||||
]
|
||||
for old, new in replacements:
|
||||
result = result.replace(old, new)
|
||||
return result
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
current = 0
|
||||
improved = 0
|
||||
for line in open(os.path.join(os.path.dirname(__file__), 'roman.txt')):
|
||||
roman = line.strip()
|
||||
current += len(roman)
|
||||
improved += len(subtractive(roman))
|
||||
print current - improved
|
38
other_resources/Project-Euler/092-square_dig_chains.py
Normal file
38
other_resources/Project-Euler/092-square_dig_chains.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/python3
|
||||
# mari von steinkirch @2013
|
||||
# steinkirch at gmail
|
||||
|
||||
def calculate_chain(n):
|
||||
n_str = str(n)
|
||||
while n_str != 1 or n_str != 89:
|
||||
n_str = str(n_str)
|
||||
sum_here = 0
|
||||
for d in n_str:
|
||||
sum_here += int(d)**2
|
||||
n_str = sum_here
|
||||
if n_str == 89:
|
||||
return 1
|
||||
if n_str == 1:
|
||||
return 0
|
||||
|
||||
|
||||
def square_dig_chains(n):
|
||||
count = 0
|
||||
for i in range(1, n+1):
|
||||
count += calculate_chain(i)
|
||||
return count
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
import time
|
||||
start = time.time()
|
||||
|
||||
print(square_dig_chains(10**7))
|
||||
|
||||
elapsed = (time.time() - start)
|
||||
print('Tests Passed!\n It took %s seconds to run them.' % (elapsed))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
21
other_resources/Project-Euler/LICENSE
Normal file
21
other_resources/Project-Euler/LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Mari Wahl
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
23
other_resources/Project-Euler/README.md
Normal file
23
other_resources/Project-Euler/README.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
# 🍟 Project Euler Solutions 🍟
|
||||
|
||||
Several of my solutions for the Euler project. For fun or profit :)
|
||||
|
||||
Most of the exercises are written in Python, but I have some Java and Clojure too.
|
||||
|
||||
Enjoy!
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
## License
|
||||
|
||||
When making a reference to my work, please use my [website](http://bt3gl.github.io/index.html).
|
||||
|
||||
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />
|
||||
|
||||
This work is licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-sa/4.0/).
|
20
other_resources/Project-Euler/larg_prod_grid.dat
Normal file
20
other_resources/Project-Euler/larg_prod_grid.dat
Normal file
|
@ -0,0 +1,20 @@
|
|||
08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
|
||||
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
|
||||
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
|
||||
52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91
|
||||
22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80
|
||||
24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50
|
||||
32 98 81 28 64 23 67 10 26 38 40 67 59 54 70 66 18 38 64 70
|
||||
67 26 20 68 02 62 12 20 95 63 94 39 63 08 40 91 66 49 94 21
|
||||
24 55 58 05 66 73 99 26 97 17 78 78 96 83 14 88 34 89 63 72
|
||||
21 36 23 09 75 00 76 44 20 45 35 14 00 61 33 97 34 31 33 95
|
||||
78 17 53 28 22 75 31 67 15 94 03 80 04 62 16 14 09 53 56 92
|
||||
16 39 05 42 96 35 31 47 55 58 88 24 00 17 54 24 36 29 85 57
|
||||
86 56 00 48 35 71 89 07 05 44 44 37 44 60 21 58 51 54 17 58
|
||||
19 80 81 68 05 94 47 69 28 73 92 13 86 52 17 77 04 89 55 40
|
||||
04 52 08 83 97 35 99 16 07 97 57 32 16 26 26 79 33 27 98 66
|
||||
88 36 68 87 57 62 20 72 03 46 33 67 46 55 12 32 63 93 53 69
|
||||
04 42 16 73 38 25 39 11 24 94 72 18 08 46 29 32 40 62 76 36
|
||||
20 69 36 41 72 30 23 88 34 62 99 69 82 67 59 85 74 04 36 16
|
||||
20 73 35 29 78 31 90 01 74 31 49 71 48 86 81 16 23 57 05 54
|
||||
01 70 54 71 83 51 54 69 16 92 33 48 61 43 52 01 89 19 67 48
|
100
other_resources/Project-Euler/large_sum.dat
Normal file
100
other_resources/Project-Euler/large_sum.dat
Normal file
|
@ -0,0 +1,100 @@
|
|||
37107287533902102798797998220837590246510135740250
|
||||
46376937677490009712648124896970078050417018260538
|
||||
74324986199524741059474233309513058123726617309629
|
||||
91942213363574161572522430563301811072406154908250
|
||||
23067588207539346171171980310421047513778063246676
|
||||
89261670696623633820136378418383684178734361726757
|
||||
28112879812849979408065481931592621691275889832738
|
||||
44274228917432520321923589422876796487670272189318
|
||||
47451445736001306439091167216856844588711603153276
|
||||
70386486105843025439939619828917593665686757934951
|
||||
62176457141856560629502157223196586755079324193331
|
||||
64906352462741904929101432445813822663347944758178
|
||||
92575867718337217661963751590579239728245598838407
|
||||
58203565325359399008402633568948830189458628227828
|
||||
80181199384826282014278194139940567587151170094390
|
||||
35398664372827112653829987240784473053190104293586
|
||||
86515506006295864861532075273371959191420517255829
|
||||
71693888707715466499115593487603532921714970056938
|
||||
54370070576826684624621495650076471787294438377604
|
||||
53282654108756828443191190634694037855217779295145
|
||||
36123272525000296071075082563815656710885258350721
|
||||
45876576172410976447339110607218265236877223636045
|
||||
17423706905851860660448207621209813287860733969412
|
||||
81142660418086830619328460811191061556940512689692
|
||||
51934325451728388641918047049293215058642563049483
|
||||
62467221648435076201727918039944693004732956340691
|
||||
15732444386908125794514089057706229429197107928209
|
||||
55037687525678773091862540744969844508330393682126
|
||||
18336384825330154686196124348767681297534375946515
|
||||
80386287592878490201521685554828717201219257766954
|
||||
78182833757993103614740356856449095527097864797581
|
||||
16726320100436897842553539920931837441497806860984
|
||||
48403098129077791799088218795327364475675590848030
|
||||
87086987551392711854517078544161852424320693150332
|
||||
59959406895756536782107074926966537676326235447210
|
||||
69793950679652694742597709739166693763042633987085
|
||||
41052684708299085211399427365734116182760315001271
|
||||
65378607361501080857009149939512557028198746004375
|
||||
35829035317434717326932123578154982629742552737307
|
||||
94953759765105305946966067683156574377167401875275
|
||||
88902802571733229619176668713819931811048770190271
|
||||
25267680276078003013678680992525463401061632866526
|
||||
36270218540497705585629946580636237993140746255962
|
||||
24074486908231174977792365466257246923322810917141
|
||||
91430288197103288597806669760892938638285025333403
|
||||
34413065578016127815921815005561868836468420090470
|
||||
23053081172816430487623791969842487255036638784583
|
||||
11487696932154902810424020138335124462181441773470
|
||||
63783299490636259666498587618221225225512486764533
|
||||
67720186971698544312419572409913959008952310058822
|
||||
95548255300263520781532296796249481641953868218774
|
||||
76085327132285723110424803456124867697064507995236
|
||||
37774242535411291684276865538926205024910326572967
|
||||
23701913275725675285653248258265463092207058596522
|
||||
29798860272258331913126375147341994889534765745501
|
||||
18495701454879288984856827726077713721403798879715
|
||||
38298203783031473527721580348144513491373226651381
|
||||
34829543829199918180278916522431027392251122869539
|
||||
40957953066405232632538044100059654939159879593635
|
||||
29746152185502371307642255121183693803580388584903
|
||||
41698116222072977186158236678424689157993532961922
|
||||
62467957194401269043877107275048102390895523597457
|
||||
23189706772547915061505504953922979530901129967519
|
||||
86188088225875314529584099251203829009407770775672
|
||||
11306739708304724483816533873502340845647058077308
|
||||
82959174767140363198008187129011875491310547126581
|
||||
97623331044818386269515456334926366572897563400500
|
||||
42846280183517070527831839425882145521227251250327
|
||||
55121603546981200581762165212827652751691296897789
|
||||
32238195734329339946437501907836945765883352399886
|
||||
75506164965184775180738168837861091527357929701337
|
||||
62177842752192623401942399639168044983993173312731
|
||||
32924185707147349566916674687634660915035914677504
|
||||
99518671430235219628894890102423325116913619626622
|
||||
73267460800591547471830798392868535206946944540724
|
||||
76841822524674417161514036427982273348055556214818
|
||||
97142617910342598647204516893989422179826088076852
|
||||
87783646182799346313767754307809363333018982642090
|
||||
10848802521674670883215120185883543223812876952786
|
||||
71329612474782464538636993009049310363619763878039
|
||||
62184073572399794223406235393808339651327408011116
|
||||
66627891981488087797941876876144230030984490851411
|
||||
60661826293682836764744779239180335110989069790714
|
||||
85786944089552990653640447425576083659976645795096
|
||||
66024396409905389607120198219976047599490197230297
|
||||
64913982680032973156037120041377903785566085089252
|
||||
16730939319872750275468906903707539413042652315011
|
||||
94809377245048795150954100921645863754710598436791
|
||||
78639167021187492431995700641917969777599028300699
|
||||
15368713711936614952811305876380278410754449733078
|
||||
40789923115535562561142322423255033685442488917353
|
||||
44889911501440648020369068063960672322193204149535
|
||||
41503128880339536053299340368006977710650566631954
|
||||
81234880673210146739058568557934581403627822703280
|
||||
82616570773948327592232845941706525094512325230608
|
||||
22918802058777319719839450180888072429661980811197
|
||||
77158542502016545090413245809786882778948721859617
|
||||
72107838435069186155435662884062257473692284509516
|
||||
20849603980134001723930671666823555245252804609722
|
||||
53503534226472524250874054075591789781264330331690
|
15
other_resources/Project-Euler/max_path_sum.dat
Normal file
15
other_resources/Project-Euler/max_path_sum.dat
Normal file
|
@ -0,0 +1,15 @@
|
|||
75
|
||||
95 64
|
||||
17 47 82
|
||||
18 35 87 10
|
||||
20 04 82 47 65
|
||||
19 01 23 75 03 34
|
||||
88 02 77 73 07 63 67
|
||||
99 65 04 28 06 16 70 92
|
||||
41 41 26 56 83 40 80 70 33
|
||||
41 48 72 33 47 32 37 16 94 29
|
||||
53 71 44 65 25 43 91 52 97 51 14
|
||||
70 11 33 28 77 73 17 78 39 68 17 57
|
||||
91 71 52 38 17 14 91 43 58 50 27 29 48
|
||||
63 66 04 68 89 53 67 30 73 16 69 87 40 31
|
||||
04 62 98 27 23 09 70 98 73 93 38 53 60 04 23
|
4
other_resources/Project-Euler/max_path_sum0.dat
Normal file
4
other_resources/Project-Euler/max_path_sum0.dat
Normal file
|
@ -0,0 +1,4 @@
|
|||
3
|
||||
7 4
|
||||
2 4 6
|
||||
8 5 9 3
|
1
other_resources/Project-Euler/names.txt
Normal file
1
other_resources/Project-Euler/names.txt
Normal file
File diff suppressed because one or more lines are too long
1000
other_resources/Project-Euler/roman.txt
Normal file
1000
other_resources/Project-Euler/roman.txt
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue