Skip to content

Instantly share code, notes, and snippets.

@8bit-pixies
Created December 27, 2012 09:27
Show Gist options
  • Save 8bit-pixies/4386876 to your computer and use it in GitHub Desktop.
Save 8bit-pixies/4386876 to your computer and use it in GitHub Desktop.
challenge 74
#chall 74 in ruby
#zeckendorf representation
def fib_seq(m)
#get array of fibonacci seq up to a certain number
seq = [1,1]
until seq[-1] > m do
seq.push(seq[-1]+seq[-2])
end
remainder = m
for x in seq.reverse
if x <= remainder.to_i
remainder = remainder - x
p x
end
end
end
fib_seq(3**15)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment