Sujet : Re: The "Strand" puzzle --- ( Posting On Python-List Prohibited)
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.pythonDate : 29. Jul 2024, 23:58:02
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v89399$ld7e$6@dont-email.me>
References : 1 2 3
User-Agent : Pan/0.159 (Vovchansk; )
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.