Last active
December 10, 2015 13:28
-
-
Save stringbot/4440653 to your computer and use it in GitHub Desktop.
The Fibonacci Promotion Schedule Generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_support/time' | |
start = "2012-11-30" | |
gens = 20 | |
def fib_series(accum,limit) | |
accum ||= [1,1] | |
return accum if accum.length >= limit | |
this = accum[-1] | |
last = accum[-2] | |
fib_series((accum << last + this), limit) | |
end | |
dates = fib_series(nil,gens).inject([Date.parse(start)]) do |accumulator,duration| | |
accumulator << accumulator.last + duration.days | |
end | |
puts dates |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
20 generations will probably exceed my lifetime, and 60 generations far exceeds the estimated lifetime of the Sun.