• Re: The "Strand" puzzle --- ( Posting On Python-List Prohibited)

    From Lawrence D'Oliveiro@21:1/5 to HenHanna on Mon Jul 29 21:58:02 2024
    On Mon, 29 Jul 2024 11:58:21 -0700, HenHanna wrote:

    ---------- is this (also) easy to do using Lisp or Python???

    I threw this code together in about two minutes:

    lo = 50
    hi = 500
    i = (lo + hi) // 2
    while True :
    losum = sum(range(lo, i))
    hisum = sum(range(i + 1, hi + 1))
    print(i, losum, hisum)
    if losum == hisum :
    break
    if losum > hisum :
    i = i - 1
    else :
    i = i + 1
    #end if
    #end while

    and it seems there is no actual solution: it keeps oscillating between 355
    and 356.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)