Challenge: find the first value where two functions differ

Ian Kelly ian.g.kelly at gmail.com
Fri Aug 4 14:17:22 EDT 2017


On Fri, Aug 4, 2017 at 10:03 AM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> On Fri, Aug 4, 2017 at 10:00 AM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
>> On Fri, Aug 4, 2017 at 9:47 AM, Chris Angelico <rosuav at gmail.com> wrote:
>>> On Sat, Aug 5, 2017 at 1:44 AM, Chris Angelico <rosuav at gmail.com> wrote:
>>>> That gave me this result almost instantaneously:
>>>>
>>>> 4503599761588224
>>>>
>>>> which has been rounded up instead of down. I don't know if that counts
>>>> as sufficiently wrong?
>>>
>>> Oh, and I forgot to say: I have no actual *proof* that this is the
>>> lowest number for which this will occur. It does not occur with
>>> 4503599761588223 (the next lower integer), but could happen with
>>> something between two squares, for all I know. However, I suspect that
>>> it wouldn't.
>>
>> Your example demonstrates that the "2**53 < M" assumption was wrong,
>> which is interesting. It may be worth checking values less than 2**26
>> as well.
>
> Less than (2**26)**2, I mean.

I modified Chris's code to check every square below 2**52.
4503599761588224 is the smallest example that is at most one off from
a perfect square.



More information about the Python-list mailing list