Sha256: 346fbfd9588bbd7e275ffe3ec33ca153db5bed1323570f6434afcc4a39e77b2b

Contents?: true

Size: 393 Bytes

Versions: 114

Compression:

Stored size: 393 Bytes

Contents

module CollatzConjecture

let steps number =  
    let rec helper count current =
        match current with 
        | _ when current < 1 -> 
            None
        | 1 -> 
            Some count
        | _ when current % 2 = 0 -> 
            helper (count + 1) (current / 2)
        | _ ->
            helper (count + 1) (current * 3 + 1)

    helper 0 number                         

Version data entries

114 entries across 114 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.138 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.137 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.136 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.135 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.134 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.133 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.132 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.131 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.130 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.129 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.128 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.127 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.126 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.125 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.124 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.123 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.122 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.121 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.120 tracks/fsharp/exercises/collatz-conjecture/Example.fs