Ad
  • Custom User Avatar
    • TypeError: 'float' object cannot be interpreted as an integer

      Your code uses floating-point division instead of integer division (times have changed since Python 2. -> 3.)

    • Your code will fail for very large non-prime numbers like 2^32 because it performs a lot of unnecessary computation in prime && divisor checking. (You should read about prime divisors and find an optimal boundary to stop the iteration)

  • Custom User Avatar

    issue with your code is not an issue, read this

  • Custom User Avatar

    I tried to check if n is a prime number when each time n changes. Hope this can help.