Sha256: 059f862f6b5bd2694e1f74c2457f831ac5c6f33e29ace3f3cf2a8d3f550be2f8
Contents?: true
Size: 259 Bytes
Versions: 94
Compression:
Stored size: 259 Bytes
Contents
def collatz_steps(n): if n <= 0: return step_count = 0 while n > 1: if is_odd(n): n = n * 3 + 1 else: n = n / 2 step_count += 1 return step_count def is_odd(n): return n % 2 == 1
Version data entries
94 entries across 94 versions & 1 rubygems