Sha256: c9d991a00f860d1bb2a8e344bf1830536f668c07163c4d3cd08eb9d8a80fd6d5

Contents?: true

Size: 285 Bytes

Versions: 193

Compression:

Stored size: 285 Bytes

Contents

module BookKeeping
  VERSION = 1
end

module CollatzConjecture
  def self.steps(num)
    raise ArgumentError if num < 1
    n = num
    steps = 0
    until n == 1
      steps += 1
      if n.even?
        n /= 2
      else
        n = 3 * n + 1
      end
    end
    steps
  end
end


Version data entries

193 entries across 193 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/ruby/exercises/collatz-conjecture/.meta/solutions/collatz_conjecture.rb
trackler-2.2.1.179 tracks/ruby/exercises/collatz-conjecture/.meta/solutions/collatz_conjecture.rb
trackler-2.2.1.178 tracks/ruby/exercises/collatz-conjecture/.meta/solutions/collatz_conjecture.rb
trackler-2.2.1.177 tracks/ruby/exercises/collatz-conjecture/.meta/solutions/collatz_conjecture.rb
trackler-2.2.1.176 tracks/ruby/exercises/collatz-conjecture/.meta/solutions/collatz_conjecture.rb
trackler-2.2.1.175 tracks/ruby/exercises/collatz-conjecture/.meta/solutions/collatz_conjecture.rb
trackler-2.2.1.174 tracks/ruby/exercises/collatz-conjecture/.meta/solutions/collatz_conjecture.rb
trackler-2.2.1.173 tracks/ruby/exercises/collatz-conjecture/.meta/solutions/collatz_conjecture.rb
trackler-2.2.1.172 tracks/ruby/exercises/collatz-conjecture/.meta/solutions/collatz_conjecture.rb
trackler-2.2.1.171 tracks/ruby/exercises/collatz-conjecture/.meta/solutions/collatz_conjecture.rb
trackler-2.2.1.170 tracks/ruby/exercises/collatz-conjecture/.meta/solutions/collatz_conjecture.rb
trackler-2.2.1.169 tracks/ruby/exercises/collatz-conjecture/.meta/solutions/collatz_conjecture.rb
trackler-2.2.1.167 tracks/ruby/exercises/collatz-conjecture/.meta/solutions/collatz_conjecture.rb
trackler-2.2.1.166 tracks/ruby/exercises/collatz-conjecture/.meta/solutions/collatz_conjecture.rb
trackler-2.2.1.165 tracks/ruby/exercises/collatz-conjecture/.meta/solutions/collatz_conjecture.rb
trackler-2.2.1.164 tracks/ruby/exercises/collatz-conjecture/.meta/solutions/collatz_conjecture.rb
trackler-2.2.1.163 tracks/ruby/exercises/collatz-conjecture/.meta/solutions/collatz_conjecture.rb
trackler-2.2.1.162 tracks/ruby/exercises/collatz-conjecture/.meta/solutions/collatz_conjecture.rb
trackler-2.2.1.161 tracks/ruby/exercises/collatz-conjecture/.meta/solutions/collatz_conjecture.rb
trackler-2.2.1.160 tracks/ruby/exercises/collatz-conjecture/.meta/solutions/collatz_conjecture.rb