Ad
  • Default User Avatar

    Incorrect large number calculation was my problem too. But when I found the solution, I was surprised how simple it was.

  • 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

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

  • Custom User Avatar

    Hello, all, I had this problem too. Even with a formula and after I forced it to be written with integers...

    170970902404966449586247098818855152577703936966215095276168985530690669141903684897 should equal 170970902404966462328920047488181969596690166234976092377640121561715772973645152611

    I really have no idea what happened and what I can do.

  • Custom User Avatar

    Please use spoiler flag next time.

  • Custom User Avatar

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

  • Custom User Avatar

    I've tested 2 solutions and it work so I guess the code you made is a bit sub-optimal or run in loop.

  • Custom User Avatar

    I have tried everything I could, but it always times out.
    I think they are just too strict on time limit in this kata.

  • Default User Avatar

    Even I'm getting the same thing as yours.
    Did you solve it?

  • Default User Avatar

    Thanks for that insight. I mistakenly believed that math.floor and math.ceil would return integers.

  • Default User Avatar

    IshaanKapoor x3

    Sizes ranging from 5 to 10 are given as examples. My formula works for all of those sizes and even numbers that are considerably larger. But when it gets to the crazy large numbers, suddenly the formula doesn't fit. I don't understand how the formula stops working above some unknown threshold size. Maybe it's something about enormous spiral sizes that I don't know.

  • Custom User Avatar

    ishaanKapoor x2

  • Custom User Avatar

    It's much easier than you think. Just observe the pattern!

  • Custom User Avatar

    I solved the problem in the following ways in the given order:

    1. recursively, Recursion Depth exceded
    2. for loop, took too much time
    3. formula, but 1.7097090240496645e+83 should equal 170970902404966462328920047488181969596690166234976092377640121561715772973645152611

    I feel like giving up now

  • Custom User Avatar

    I have the same problem, the 2nd one ['e', 'w', 'e', 'w', 'e', 's', 'n', 's', 'e', 'w'] should be correct but it says False, Why is it so, any Idea??