Re: The "Strand" puzzle --- ( Continued Fractions using Lisp orPython? )

Liste des GroupesRevenir à r puzzles 
Sujet : Re: The "Strand" puzzle --- ( Continued Fractions using Lisp orPython? )
De : droleary (at) *nospam* 2017usenet1.subsume.com (Doc O'Leary ,)
Groupes : rec.puzzles
Date : 02. Aug 2024, 16:54:42
Autres entêtes
Organisation : Subsume Technologies, Inc.
Message-ID : <v8ivg2$2sgfk$1@dont-email.me>
References : 1 2 3 4 5
User-Agent : com.subsume.NNTP/1.0.0
For your reference, records indicate that
"B. Pym" <Nobody447095@here-nor-there.org> wrote:

  ===>
352

 
Faster:

But is it correct?  Because surrounding 352 I get (with Ruby):

irb(main):001:0> (50..351).sum
=> 60551
irb(main):002:0> (353..500).sum
=> 63122

This solution for the example:

irb> x = 1
=> 1
irb> y = 8
=> 8
irb> (x..y).select {|n| (x..(n-1)).sum == ((n+1)..y).sum}
=> [6]

For the puzzle yields:

irb> x = 50
=> 50
irb> y = 500
=> 500
irb> (x..y).select {|n| (x..n-1).sum == (n+1..y).sum}
=> []

So no house.  I’ll skip the full output, but for the tipping point I see:

irb> (x..y).select {|n| puts "#{n} #{(x..(n-1)).sum} #{((n+1)..y).sum}"}

355 61610 62060
356 61965 61704

--
"Also . . . I can kill you with my brain."
River Tam, Trash, Firefly



Date Sujet#  Auteur
25 Jul 24 * The "Strand" puzzle14HenHanna
26 Jul 24 `* Re: The "Strand" puzzle13IlanMayer
29 Jul 24  `* Re: The "Strand" puzzle --- ( Continued Fractions using Lisp or Python? )12HenHanna
30 Jul 24   +* Re: The "Strand" puzzle --- ( Continued Fractions using Lisp or Python? )3IlanMayer
31 Jul 24   i+- Re: The "Strand" puzzle --- ( Continued Fractions using Lisp or Python? )1HenHanna
20 Aug 24   i`- Re: The "Strand" puzzle --- ( Continued Fractions using Lisp or Python? )1Phil Carmody
1 Aug 24   `* Re: The "Strand" puzzle --- ( Continued Fractions using Lisp orPython? )8B. Pym
1 Aug 24    +* Re: The "Strand" puzzle --- ( Continued Fractions using Lisp orPython? )2HenHanna
1 Aug 24    i`- Re: The "Strand" puzzle --- ( Continued Fractions using Lisp orPython? )1Moebius
2 Aug 24    +* Re: The "Strand" puzzle --- ( Continued Fractions using Lisp orPython? )3B. Pym
2 Aug 24    i`* Re: The "Strand" puzzle --- ( Continued Fractions using Lisp orPython? )2Doc O'Leary ,
2 Aug 24    i `- Re: The "Strand" puzzle --- ( Continued Fractions using Lisp orPython? )1Doc O'Leary ,
2 Aug 24    +- Re: The "Strand" puzzle --- ( Continued Fractions using Lisp orPython? )1B. Pym
4 Aug 24    `- Re: The "Strand" puzzle --- ( Continued Fractions using Lisp orPython? )1B. Pym

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal