Consider this code snippet.
>>> n, m = 10011617, 100000000000006340
>>> s = lambda n: n * (n + 1) / 2
>>> s(n)
50116242483153.0
>>> s(n) == int(s(n))
True
>>> m % s(n)
18096246116101.0
>>> m % int(s(n))
18096246116105
As you can see, s(n)
is an integer (mathematically), yet m % s(n) != m % int(s(n))
.
Could this have to do with s(n)
or m
being a long under the hood? Even if that's the case, why does s(n) == int(s(n))
yet when I take the modulus the results are not equal?
P.S. I ran this in repl.it