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

    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

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

  • 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

    X4 having the same problem. My formula works for smaller values but the final test case gives the following error:

    170970902404966449586247098818855152577703936966215095276168985530690669141903684898 should equal
    170970902404966462328920047488181969596690166234976092377640121561715772973645152611

    does something happen when the numbers become really large? I can't see why it should be inaccurate for this value yet correct for the others

    Update: not sure if it will help others but making sure that only type'int' was in the equation solved my large number inaccuracy. Best of luck everyone

  • 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!