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.180 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.179 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.178 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.177 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.176 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.175 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.174 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.173 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.172 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.171 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.170 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.169 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.167 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.166 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.165 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.164 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.163 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.162 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.161 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.160 tracks/fsharp/exercises/collatz-conjecture/Example.fs