Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Debug.Trace
- --collatz 0 = 0
- collatz 1 = 1
- collatz n = if even n
- then (trace (show n) (collatz (n `div` 2)))
- else (trace (show n) (collatz (3*n+1)))
- collatzAufrufe 1 = 1
- collatzAufrufe n = if even n
- then (1 + (collatzAufrufe (n `div` 2)))
- else (1 + (collatzAufrufe (3*n+1)))
- welcheZahl 1 a = a
- welcheZahl i a = if ((collatzAufrufe (i-1)) >= (collatzAufrufe i)) then (welcheZahl (i-1) (a-1)) else (welcheZahl (i-1) a)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement