Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Ghosts Age by yukirin
def checkio(opacity, opa=10000, fib=[1, 1]):
if opacity == 10000: return 0
while not opa == opacity and len(fib) - 1 < 5000:
opa += -(len(fib) - 1) if len(fib) - 1 in fib else 1
fib = fib[:] + [fib[-2] + fib[-1]]
return len(fib) - 2
if __name__ == '__main__':
assert checkio(10000) == 0, "Newborn"
assert checkio(9999) == 1, "1 year"
assert checkio(9997) == 2, "2 years"
assert checkio(9994) == 3, "3 years"
assert checkio(9995) == 4, "4 years"
assert checkio(9990) == 5, "5 years"
April 7, 2015
Comments: