package kapitel_01 /** * Beispiel aus * * - Algorithmen und Datenstrukturen für Dummies * - von Andreas Gogol-Döring und Thomas Letschert * - Verlag Wiley-VCH; Oktober 2019 * - Kapitel 1, Das sind Algorithmen * * @author A. Gogol-Döring, Th. Letschert */ object AuD_01_04_Collatz_App extends App { def Collatz(n: Int): Unit = { var n_ = n while (n_ > 1) { println(n_) if (n_ % 2 == 0) n_ = n_ / 2 else n_ = 3 * n_ + 1 } } Collatz(25) }