You will write your own factorial function with a loop, use it to count down a product, and find where factorials pass a million. The checker tests your work against math.factorial.
The idea. Start with 1, which is , and multiply by , , ... up to . A product of numbers counting down from is .
Your tasks.
factorial(n): it must return for , and for larger .count_down(n, k): the product of the numbers , , ..., using factorial and //.first_big to the smallest for which is more than .Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…
With Standard, you also open 12 more problems, 2 Python labs and 1 extra course. Everything you have used here stays free, always.