aboutsummaryrefslogtreecommitdiffstats
path: root/OLD/ee2301/collatz.py
blob: 14873bedec89d4587e0f7d25c387a83bff99f0b2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
def collatzCount(number):
    for n in range (1,number+1):
        collatzConjecture(n)
        #print("\n")

def collatzConjecture(n):
    #print(n, end = ' ')
    if n is 1:
        return 1
    else:
        if n%2:
            return collatzConjecture(int((n*3)+1))
        else:
            return collatzConjecture(int(n/2))
        raise AssertionError


try:
    collatzCount(10000)
except AssertionError:
    print("The Collatz Conjecture is false!")