You are viewing a single comment's thread. Return to all comments →
main = readLn >>= print . (+1) . f 0
f n x | x > 3*(2^n) = f (n+1) (x-3*(2^n)) | otherwise = 3*(2^n) - x
Seems like cookies are disabled on this browser, please enable them to open this website
Strange Counter
You are viewing a single comment's thread. Return to all comments →
main = readLn >>= print . (+1) . f 0
f n x | x > 3*(2^n) = f (n+1) (x-3*(2^n)) | otherwise = 3*(2^n) - x