author | Christian Urban <christian.urban@kcl.ac.uk> |
Sun, 15 Sep 2024 12:57:59 +0100 | |
changeset 493 | 244df77507c2 |
parent 470 | 86a456f8cb92 |
permissions | -rw-r--r-- |
396 | 1 |
// Core Part 1 about the 3n+1 conjecture |
343 | 2 |
//============================================ |
11
417869f65585
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
3 |
|
396 | 4 |
object C1 { |
11
417869f65585
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
5 |
|
428
cdfa6a293453
updated solutions and templates
Christian Urban <christian.urban@kcl.ac.uk>
parents:
396
diff
changeset
|
6 |
// ADD YOUR CODE BELOW |
cdfa6a293453
updated solutions and templates
Christian Urban <christian.urban@kcl.ac.uk>
parents:
396
diff
changeset
|
7 |
//====================== |
11
417869f65585
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
8 |
|
428
cdfa6a293453
updated solutions and templates
Christian Urban <christian.urban@kcl.ac.uk>
parents:
396
diff
changeset
|
9 |
|
cdfa6a293453
updated solutions and templates
Christian Urban <christian.urban@kcl.ac.uk>
parents:
396
diff
changeset
|
10 |
//(1) |
343 | 11 |
def collatz(n: Long) : Long = ??? |
11
417869f65585
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
12 |
|
428
cdfa6a293453
updated solutions and templates
Christian Urban <christian.urban@kcl.ac.uk>
parents:
396
diff
changeset
|
13 |
//(2) |
343 | 14 |
def collatz_max(bnd: Long) : (Long, Long) = ??? |
15 |
||
428
cdfa6a293453
updated solutions and templates
Christian Urban <christian.urban@kcl.ac.uk>
parents:
396
diff
changeset
|
16 |
//(3) |
343 | 17 |
def is_pow_of_two(n: Long) : Boolean = ??? |
18 |
||
19 |
def is_hard(n: Long) : Boolean = ??? |
|
20 |
||
21 |
def last_odd(n: Long) : Long = ??? |
|
11
417869f65585
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
22 |
|
470 | 23 |
|
281 | 24 |
} |
11
417869f65585
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
25 |