Skip to content
Snippets Groups Projects
Commit 74956409 authored by David Grellscheid's avatar David Grellscheid
Browse files

Starting scaffold for euler problem 14

parents
Branches main
No related tags found
No related merge requests found
import sys
def collatz_len(N):
return 1, 1
if __name__ == "__main__":
# should really use argparse here
if len(sys.argv) < 2:
print(f"Usage: {__file__} NNN")
exit(1)
max_N = int(sys.argv[1])
start, length = collatz_len(max_N)
print(f"The longest collatz chain up to {N} starts at {start} and has {length} elements.")
import euler014 as E
def test_collatz_len_returns_tuple():
assert len(E.collatz_len(1)) == 2
def test_collatz_step_odd():
assert E.collatz_step(3) == 7
def test_collatz_step_even():
assert E.collatz_step(10) == 5
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment