author | Christian Urban <christian.urban@kcl.ac.uk> |
Fri, 25 Nov 2022 00:03:15 +0000 | |
changeset 448 | db2a3e3287a9 |
parent 430 | 274c865b3878 |
child 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 |
|
417869f65585
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
13 |
|
428
cdfa6a293453
updated solutions and templates
Christian Urban <christian.urban@kcl.ac.uk>
parents:
396
diff
changeset
|
14 |
//(2) |
343 | 15 |
def collatz_max(bnd: Long) : (Long, Long) = ??? |
16 |
||
428
cdfa6a293453
updated solutions and templates
Christian Urban <christian.urban@kcl.ac.uk>
parents:
396
diff
changeset
|
17 |
//(3) |
343 | 18 |
def is_pow_of_two(n: Long) : Boolean = ??? |
19 |
||
20 |
def is_hard(n: Long) : Boolean = ??? |
|
21 |
||
22 |
def last_odd(n: Long) : Long = ??? |
|
11
417869f65585
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
23 |
|
281 | 24 |
} |
11
417869f65585
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
25 |