Ad
  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    Anyone came up with a working solution for this? I'm also puzzled as to why the formula works for smaller numbers, but doesn't work for the big ones.
    Even when specifying int. I also found that the formula breaks at exactly 16th digit. I.E. the first 16 digits are always correct.
    EDIT: I finally have an answer. The thing is, even when I specify int(), python still converts to float when dividing. Naturally, changing all divisions to floor divisions (//) solved the problem.

  • Custom User Avatar

    Thank you for that. Finally found the issue. I forgot to reset my variables after calling the function once.

  • Custom User Avatar

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

  • Custom User Avatar

    Coming from a Python noob, for those (like me, one hour ago) who think that "there's something wrong with this kata and there's no way my script is wrong...right?" I say this:
    So far, this is the most effective kata at teaching some very fundamental concepts that I definitely missed.
    I strongly recommend reading this: https://nedbatchelder.com/text/names1.html
    I promise, you'll come back with a solution.