Public feed #376494

zbrown

public text v1 · immutable
Raw Edit
·published 2007-03-01 02:09 UTC
rendered paste body
module Main
        where

import IO

main = do
        putStrLn "Enter an integer to test the 3x+1 conjecture on:"
        num <- getLine
        threeXconject (read num)

threeXconject :: Int -> Int
threeXconject x 
        | x == 1 = 1
        | (x `mod` 2) == 0 = threeXconject 2*x
        | otherwise = threeXconject (3*x + 1)