Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
def fizzbuzz start, limit
(start..limit).to_a.map { |n|
printFizzBuzzForInput n
}
end
def printFizzBuzzForInput n
print "#{'fizz' * f(n)}"
print "#{'buzz' * g(n)}"
print "#{n.to_s * h(n)}"
print "\n"
end
def f n
((n % 3 / (n % 3 + 1.0)).ceil - 1) * (-1)
end
def g n
((n % 5 / (n % 5 + 1.0)).ceil - 1) * (-1)
end
def h n
(n % 3 / (n % 3 + 1.0)).ceil * (n % 5 / (n % 5 + 1.0)).ceil
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment