Sha256: c9dbc627f4c71ad21e0900e46701c099207bb6bbab4b531fedb919f22227e4bd

Contents?: true

Size: 394 Bytes

Versions: 4

Compression:

Stored size: 394 Bytes

Contents

# @author Kent 'picat' Gruber
module Goffir
  # Are you some sort of Ruby purist?
  # 
  # @example
  #   Goffir.purist(42) # 36 seconds later...
  #   # => 267914296 
  #
  # @param  [Integer] Desired number in the sequence to calculate to.
  # @return [Integer] The number in the sequence at that number.
  #
  def self.purist(n)
    n <= 1 ? n : purist( n - 1 ) + purist( n - 2 ) 
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
goffir-1.0.3pre lib/goffir/purist.rb
goffir-1.0.2pre lib/goffir/purist.rb
goffir-1.0.1pre lib/goffir/purist.rb
goffir-1.0.0pre lib/goffir/purist.rb