Ad
  • Custom User Avatar

    Thanks for the tips, tried to solve it for way too long, was impossible without the theorems.

  • Default User Avatar

    I don't think it's a browser issue. For some reason, it's displayed as 109 in a trainer URL (kata/abcd/train/your_language), but as 10⁹ in the main kata page (kata/abcd/). It goes back to 10⁹ if you select another language while in the trainer (probably because the markdown gets re-parsed in case there are conditional code blocks etc.). This happens to me on both Firefox and Chromium. Perhaps using pure Markdown like `$10^9$` would work better

  • Custom User Avatar

    Yes, I see it as 10 to the power of 9 in Chrome. If you inspect the code, it's written as 10<sup>9</sup> Maybe the problem is it's also inside some <code>tags and Edge can't process that?

  • Custom User Avatar

    I agree with you that 10 to the power of 9 is equivalent to 1e9.

    Is it displayed as 10 to the power of 9 on your browser?

    On my browser (latest version of Edge) it is literally disaplyed as the number 109.

  • Custom User Avatar

    3 < n < 109

    1e9 and 109 are equivalent.

  • Custom User Avatar

    The instruction should be updated:

    Currently it says:
    3 < n < 109

    But I think you actually meant:
    3 < n < 1e9

  • Custom User Avatar

    I guess it's hard finding the solution on your own, however nice one.

  • Default User Avatar

    Howdy, I need some help from you guys :)

    So, I am using C++ and I was able to have a solution that passes all the tests (including the timeout ones), but it fails afterwards on random tests.

    Here are 2 examples: 141163297, 415765168. In both cases, my answer is 4 while the random tests expect 3.

    I believe it's some problem in my implementation related to some overflow cases, but it's being hard for me to pinpoint the exact reason...
    In order to debug better, I was wondering is someone has a working solution at hand and they could provide me for the 2 numbers:
    141163297
    415765168

    the 3 squared numbers whose sum adds to them.

    Thanks a lot!

  • Custom User Avatar
  • Custom User Avatar

    I mean, that works, but it's kind of a shitty fix.

    I feel like the best solution to this problem would be to make sure that there are at least something like 20 tests where the answers should be 1, 2, '3', and 4. Then you can leave some extra 20 tests that are fully random.

    It shouldn't be too hard to create a test for a given number of squares.

    You can even do something lazy like this:

    def make_test(number_of_squares: int) -> int:
    
        n: int = randint(10 ** 8, 10 ** 9)
    
        while sum_of_squares_sol(n) != number_of_squares:
            n = randint(10 ** 8, 10 ** 9)
    
        return n
    

    Then maybe shuffle the tests around so they can't be hardcoded.

  • Default User Avatar

    there were only 15 random tests in Python, i bumped it to 100. your and akar-0's solutions do not pass anymore, but i dont know if that's enough, your solutions only fail around 15 random tests each time

  • Custom User Avatar

    Closing then

  • Custom User Avatar

    It would be better if someone fixed the issue, lol.

  • Default User Avatar

    closing then, only one issue should be kept

  • Custom User Avatar

    Yeah, it's the same, I only realized after posting.

  • Loading more items...