Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
All,
Some egg timers look like a scaled down version of an hour glass. There are a number of puzzles for cooking eggs a specified amount of time where the solution isn't obvious. It requires realizing that by turning over two egg timers at the same time when the smaller has finished you can stop the larger and have 2 new amounts to work with.

For instance, given 7-min & 4-min egg timers, you can split the 7-min into 4/3. You can split the 4-min into 1/3 by turning it over twice in the time the 7-min runs once. Continuing that further you can split the 7-min into 1/6 by letting the 1 minute side of the 4 run.

You get the picture.

The challenge is to create a program that - given a target amount and a variable amount of egg timers, will generate solution(s) for the puzzle. All solutions are welcome but non-straight forward approaches will get creativity bonus points. For those following along at home, adding an explanation in spoiler tags will get you tutelage bonus points.

Update: There are 2 aspects of this puzzle so far that have been interpreted differently. The first is the number of timers. I intended this to be a specific number and not an infinite amount. The second is if timers have to run continously or can be set aside (by turning them on their side). My intention was to allow timers to be stopped for later use. Feel free to intepret the problem any way you want, but these were my intentions.

Update 2: Given an infinite amount of time it may be possible to arrive at any value running timers end to end as it would be by "saving off intermediate values". I don't have proof either way but I suspect some values would only be possible by stopping timers. To force the issue, a nice variation would be to impose an overall time limit for cooking the egg (IOW minimize the overall time). Your choice.

Cheers - L~R


In reply to Challenge: Egg Timer Puzzles by Limbic~Region

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (4)
    As of 2019-11-15 05:12 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Strict and warnings: which comes first?



      Results (80 votes). Check out past polls.

      Notices?