Can you guess which conjecture these try to test?

let f l 1=l++[1];f l k|mod k 2==0=f(l++[k])(div k 2);f l k=f(l++[k])(3*k+1)in putStr $ unlines $ map (show . f[]) [1..11]

let f l 1=reverse(1:l);f l k|mod k 2==0=f(k:l)(div k 2);f l k=f(k:l)(3*k+1)in putStr $ unlines $ map (show . f[]) [1..11]

let f 1=Nothing;f k=Just(g k,g k);g k|mod k 2==0=div k 2;g k=3*k+1 in putStr $ unlines $ map (show . \n -> n:unfoldr f n) [1..11]

let f 1=Nothing;f k=let x=(if mod k 2==0 then div k 2 else 3*k+1)in Just(x,x)in putStr $ unlines $ map (show . \n -> n:unfoldr f n) [1..11]

Comments

  1. Collatz conjecture?

    ReplyDelete
  2. Correct! :-)

    Did you notice the hidden hint, or are you such advanced in math?

    Anyway, congratulations! You're invited for a glass of wine, my friend!

    ReplyDelete
  3. I've heard about it from the UVA's ACM problemset. It's the first problem there.

    ReplyDelete
  4. Thanks! Hm, that gives me an idea! ;-)

    ReplyDelete

Post a Comment

Popular posts from this blog

Tftp secret of TL-WR740N uncovered

Hidden TFTP of TP-Link routers

Haskell for embedded: C output, compilers, monads, Timber