Collatz: Ruby 🔻💎🔻¶ ↑
Functions related to the Collatz/Syracuse/3N+1 problem, implemented in Ruby.
Getting Started¶ ↑
To install the latest from RubyGems;
gem install collatz
Or to install from GitHub’s hosted gems;
gem install collatz --source "https://rubygems.pkg.github.com/skenvy"
Add to the Gemfile¶ ↑
gem "collatz", ">= 0.1.0
source "https://rubygems.pkg.github.com/skenvy" do gem "collatz", ">= 0.1.0" end
Usage¶ ↑
Provides the basic functionality to interact with the Collatz
conjecture. The parameterisation uses the same (P,a,b)
notation as Conway’s generalisations. Besides the function and reverse function, there is also functionality to retrieve the hailstone sequence, the “stopping time”/“total stopping time”, or tree-graph. The only restriction placed on parameters is that both P
and a
can’t be 0
.
RDoc generated docs¶ ↑
Developing¶ ↑
The first time setup¶ ↑
git clone https://github.com/Skenvy/Collatz.git && cd Collatz/ruby && make setup
Iterative development¶ ↑
The majority of make
recipes for this are just wrapping a bundle
invocation of rake
. * make docs
will recreate the RDoc docs * make test
will run both the RSpec tests and the RuboCop linter.