changeset 171 | 4c9497ab5caa |
parent 167 | 349d706586ef |
child 197 | c3e39fdeea3b |
--- a/testing1/collatz.scala Fri Feb 23 22:26:42 2018 +0000 +++ b/testing1/collatz.scala Thu Mar 08 12:32:50 2018 +0000 @@ -21,3 +21,9 @@ } +def Collat(n: Long, r: Int = 1) : Int = + if (n == 1) r else + if (n % 2 == 0) Collat(n / 2 , r + 1) else + Collat (3 * n + 1 , r + 1) + +(1 to 10).map(collatz(_))