Name: Anonymous 2013-02-23 7:48
I'm trying to write a program in python named get_numrubix_cubes that does the following:
It calculates how many rubix cubes it takes to stack up to any height building in meters.
Assume every rubix cube you stack is 0.057 meters on each side. However, I need to take into consideration the compression factor for every cube stacked, which is the following: ((1-1/100000)^n)
So when I run the program, this would be an example of the output:
get_numrubix_cubes(42.5) = 749
How can I do this recursively? I can't think of any way to do it. I know its already possible without the use of recursion which is blowing my mind.
It calculates how many rubix cubes it takes to stack up to any height building in meters.
Assume every rubix cube you stack is 0.057 meters on each side. However, I need to take into consideration the compression factor for every cube stacked, which is the following: ((1-1/100000)^n)
So when I run the program, this would be an example of the output:
get_numrubix_cubes(42.5) = 749
How can I do this recursively? I can't think of any way to do it. I know its already possible without the use of recursion which is blowing my mind.