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.159 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.158 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.157 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.156 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.155 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.154 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.153 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.152 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.151 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.150 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.149 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.148 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.147 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.146 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.145 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.144 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.143 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.142 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.141 tracks/fsharp/exercises/collatz-conjecture/Example.fs
trackler-2.2.1.140 tracks/fsharp/exercises/collatz-conjecture/Example.fs