Ad
  • Custom User Avatar

    Give me a bit to debug. I think you've found a bug.

    [Edit]
    I've got it! The correct answer for 269097409565171420 is obvious -- it should be 269097409565171402, so check this out:

    console.log(269097409565171402);
    

    which outputs:

    269097409565171400
    

    So it's not so much a bug in the accepted-algorithm as it is a numeric bug in the javascript tests. Javascript respresents its numbers floating-point that can only be counted on to contain 16 significant digits. See: http://stackoverflow.com/a/1086603
    So, I will change the javascript tests to reduce the maximum possible random number to be 16 or fewer digits.

    Very interesting find and thank you for your input! :)

    [Edit] Fixed. I have adjusted the javascript test upper-bounds to be lower -- 16 digits or less, but I have left the others with 64-bit long integer support as-is.

  • Custom User Avatar

    In Java return null.