Project Euler #1: Multiples of 3 and 5

  • + 2 comments

    or anyone who is using Python3. If you've already converted from the iterive to the O(1) solution but you're still getting the "wrong answer" with Test Cases 2 and 3 here is why: When you divide integers in python 3, the answer is converted automatically to a float. Becuase Test Cases 2 and 3 involve very large numbers, when you convert back to integer, there will be a huge rounding error and your answers will be wrong. so rather than dividing with 2 or multiplying by 0.5 just do right shift by 1.