Sha256: 8969afd101934805403bb4e5bd2bea6aa1096627b99f12df8f7ec2b806028b09
Contents?: true
Size: 351 Bytes
Versions: 154
Compression:
Stored size: 351 Bytes
Contents
exception NegativeInteger fun steps number = let fun odd n = n mod 2 = 1 fun steps' stepCount n = if n = 1 then stepCount else if odd n then steps' (stepCount + 1) (3 * n + 1) else steps' (stepCount + 1) (n div 2) in if number > 0 then steps' 0 number else raise NegativeInteger end
Version data entries
154 entries across 154 versions & 1 rubygems