Ad
  • Custom User Avatar

    I'v already done it better.

  • Custom User Avatar

    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.

  • Custom User Avatar

    I have tried to calculate all terms in path from 1 to n like (1! + 2! + ... n!) and then divide it to n!

  • Custom User Avatar

    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

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution