Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I'v already done it better.
Calculating all factorials will not work, factorials are too large and take too long to compute.
bigdecimal is not really necessary, problem is perfectly solvable with floating point numbers.
You need to think of some better approach than calculating all factorials. Work with the formula with pen and paper, you might find a way to reduce some terms in some way.
I have tried to calculate all terms in path from 1 to n like (1! + 2! + ... n!) and then divide it to n!
I ran my code a couple time - I am passing all the tests, but I am also getting an exit code. Am I doing something wrong? I tried adding
import sys
sys.setrecursionlimit(10**6)
into my code, but then it doesn't run at all on here - runs fine on my computer
This comment is hidden because it contains spoiler information about the solution