Rocket science

Useful to know: basic math operations.

We'll get you familiar with how submitting code to Project Lovelace works by doing some rocket science! Moving stuff to outer space is super expensive and takes a lot of energy, which is part of the reason why colonizing the moon or terraforming Mars is extremely hard. To move something heavy into space you need a rocket with enough fuel. But adding fuel makes the rocket even heavier... And if you wanted to visit Mars and come back, you would need enough fuel to leave both Earth and Mars.

We can actually calculate how much fuel a rocket needs using the rocket equation: $m_\mathrm{fuel} = M \left( e^{v/v_e} - 1\right)$ where $M$ is the mass of the rocket (with no fuel), $v_e$ is the exhaust velocity of the rocket, and $e = 2.71828\dots$ is Euler's number. $v$ is the velocity the rocket needs to escape, which is different for every planet. Try to submit some code with a function rocket_fuel(v) that returns $m_\mathrm{fuel}$ for Saturn V ($M = 250,000 \; \mathrm{kg}$, $v_e = 2,550 \; \mathrm{m/s}$) as a function of $v$.

Input: The velocity $v$ the rocket needs to reach (in meters per second [m/s]) to escape the planet.

Output: The mass of fuel $m_\mathrm{fuel}$ needed by the rocket to escape the planet in kilograms (kg).

Example input

11186.0

Example output

19843016.2

You must be logged in to submit code but you can play around with the editor.

You must be logged in to upload code.

### Notes

• We basically rearranged the Tsiolkovsky rocket equation in this problem. Wikipedia shows a pretty common derivation of the rocket equation.
• Kurzgesagt has a great YouTube video essentially about the rocket equation and why it's so hard to leave Earth: Why Earth Is A Prison and How To Escape It.
• At a launch cost of US$1.16 billion (2016 value) and a low Earth orbit payload of 140,000 kg, it cost$8,286 per kg to send stuff to space using the Saturn V.
• The example uses the escape velocity of Earth (11.186 km/s) and Wikipedia has a list of escape velocities for many other celestial bodies.

### References

F-1 Engine Fact Sheet , NASA Saturn V News Reference (1968)
This is where we sourced the numbers for the Saturn V in this problem. The full Saturn V Press Kit is also online.