Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

the hourglass problem

275 views
Skip to first unread message

RichD

unread,
Dec 31, 2011, 9:03:48 PM12/31/11
to
You're given a 7 minute, and a 4 minute, sand
hourglass. Measure a 9 minute interval, in the first
9 minutes. (no 'setup' period)

ok, this is trivial. But as computer nerds, we're
interested in general solutions. So, given hourglasses
of n and m minutes:

1) Can you devise a formula which generates a list of
all possible intervals produced by them?

2) And an algorithm, which generates the interval,
for any given number on the list.

Of course, this is solvable via brute force, but we
want something efficient.

PS The problem stated above is a Google
interview question! Which lowers my estimate of
their intellectual prowess.

--
Rich

William Elliot

unread,
Dec 31, 2011, 10:21:35 PM12/31/11
to
On Sat, 31 Dec 2011, RichD wrote:

> You're given a 7 minute, and a 4 minute, sand
> hourglass. Measure a 9 minute interval, in the first
> 9 minutes. (no 'setup' period)
>
Can't be done without a setup.

Dave Dodson

unread,
Dec 31, 2011, 10:41:55 PM12/31/11
to
On Dec 31, 9:21 pm, William Elliot <ma...@rdrop.com> wrote:
> On Sat, 31 Dec 2011, RichD wrote:
> > You're given a 7 minute, and a 4 minute, sand
> > hourglass.  Measure a 9 minute interval, in the first
> > 9 minutes.  (no 'setup' period)
>
> Can't be done without a setup.

How about this: Start both timers. When the four-minute timer runs out
(at 4 minutes), turn it over. When the seven-minute timer runs out (at
7 minutes), turn it over. When the four-minute timer runs out again
(at 8 minutes), turn the seven-minute timer over. It will run out at 9
minutes.

Dave

root

unread,
Jan 1, 2012, 12:51:24 AM1/1/12
to
This problem is very interesting. After you realize
how to get 9 minutes, you then realize you are
able to get 4 minutes, 7 minutes, and then every
integer minute thereafter. So the numbers realizable
without delay are:
4,7,8,9,10,11,12........

Then, clearly, with a 7 minute delay you can generate
every integer minute.

William Elliot

unread,
Jan 1, 2012, 10:48:22 PM1/1/12
to
Beside having a set up period, I dispute its correctness.
Here's what I saw.

Set off 7 and 4, reset 4, reset 7, reset 4, reset 4.
Mark end of second 7 as start. Forth 4 has two minutes
to go. At end of forth 4, again set off 7.

As that had set up period of 14 minutes, it was discarded.

William Elliot

unread,
Jan 1, 2012, 11:04:45 PM1/1/12
to
On Sun, 1 Jan 2012, root wrote:
> RichD <r_dela...@yahoo.com> wrote:

>> You're given a 7 minute, and a 4 minute, sand
>> hourglass. Measure a 9 minute interval, in the first
>> 9 minutes. (no 'setup' period)
>>
>> ok, this is trivial. But as computer nerds, we're
>> interested in general solutions. So, given hourglasses
>> of n and m minutes:
>>
>> 1) Can you devise a formula which generates a list of
>> all possible intervals produced by them?

> This problem is very interesting. After you realize
> how to get 9 minutes, you then realize you are
> able to get 4 minutes, 7 minutes, and then every
> integer minute thereafter. So the numbers realizable
> without delay are:
> 4,7,8,9,10,11,12........
>
How did you realize 9, 10 and 11 without any delay?

> Then, clearly, with a 7 minute delay you can generate
> every integer minute.

How can you generate 2 and 9 with only a 7 minute delay?

Patricia Shanahan

unread,
Jan 1, 2012, 11:44:12 PM1/1/12
to
I don't think "reset" is an operation for a sand hourglass.
The operations are:

1. Turning it over.

2. Observing the sand finishing flowing from one chamber to the other.

> As that had set up period of 14 minutes, it was discarded.

Here's the 9 minute sequence from above, reformatted and with a little
more explanation:

Time 0: start both timers.
Time 4: four-minute timer expires, turn it over.
Time 7: seven-minute time expires, turn it over.
Time 8: four-minute time expires again. Turn over the seven-minute timer.
Time 9: The one-minute's worth of sand that had passed through the
seven-minute timer between Time 7 and Time 8 finishes flowing back, and
the seven-minute timer expires again.

This depends on the idea that if an M minute timer is started with all
the sand in one chamber, run for N<=M minutes, and then turned over, it
will expire in another N minutes.

Patricia

William Elliot

unread,
Jan 2, 2012, 2:08:22 AM1/2/12
to
This is a 7 minute set up that's taken as the starting point.
The four minute timers has one more minute to go. After it's
done restart it two times for a total of 9 minutes from the
starting point.

Duncan Booth

unread,
Jan 2, 2012, 6:42:53 AM1/2/12
to
William Elliot <ma...@rdrop.com> wrote:

> On Sun, 1 Jan 2012, root wrote:
>> RichD <r_dela...@yahoo.com> wrote:
>
>>> You're given a 7 minute, and a 4 minute, sand
>>> hourglass. Measure a 9 minute interval, in the first
>>> 9 minutes. (no 'setup' period)
>>>
>>> ok, this is trivial. But as computer nerds, we're
>>> interested in general solutions. So, given hourglasses
>>> of n and m minutes:
>>>
>>> 1) Can you devise a formula which generates a list of
>>> all possible intervals produced by them?
>
>> This problem is very interesting. After you realize
>> how to get 9 minutes, you then realize you are
>> able to get 4 minutes, 7 minutes, and then every
>> integer minute thereafter. So the numbers realizable
>> without delay are:
>> 4,7,8,9,10,11,12........
>>
> How did you realize 9, 10 and 11 without any delay?

The solution for 9 has already been posted multiple times.

10 and 11 are simple extensions of the solution for 9:

start both timers (t=0)
turn over the 4 minute timer when it expires (t=4)
turn over the 7 minute timer when it expires (t=7)
turn over both timers when the 4 minute timer expires (t=8)
turn over both timers when the 7 minute timer expires (t=9)
turn over both timers when the 4 minute timer expires (t=10)
turn over both timers when the 7 minute timer expires (t=11)
... and keep on marking every minute from 7 until you get bored.

>
>> Then, clearly, with a 7 minute delay you can generate
>> every integer minute.
>
> How can you generate 2 and 9 with only a 7 minute delay?

Same way you generate 9 and 16 with no delay.



--
Duncan Booth

Duncan Booth

unread,
Jan 2, 2012, 6:50:44 AM1/2/12
to
RichD <r_dela...@yahoo.com> wrote:

> PS The problem stated above is a Google
> interview question! Which lowers my estimate of
> their intellectual prowess.

When I was being interviewed by Google they didn't ask me any questions
like this one, but your generalized questions would be very much more the
sort of thing they ask.

They are very keen on whiteboard coding questions so I wouldn't have been
at all suprised if they had asked me "given two hourglasses of m and n
minutes and a desired time t minutes write a function that would take the
above as arguments and print out the required steps to reach the desired
time."

--
Duncan Booth

Patricia Shanahan

unread,
Jan 2, 2012, 10:55:30 AM1/2/12
to
No, you need to continue with the specified sequence, which finishes in
9 minutes from the start.

I think you are ignoring two key features of a sand hourglass:

1. The sand flows at a more-or-less even rate if the top is not empty.

2. You can turn it over at any time, even if the top is not yet empty.

Suppose you start a M-minute timer (M>1) with all the sand in the top,
wait one minute, and then turn it over. The top now contains the amount
of sand that takes one minute to flow to the bottom, and it will empty
in one more minute.

Dr Nick

unread,
Jan 2, 2012, 11:17:55 AM1/2/12
to
Patricia Shanahan <pa...@acm.org> writes:

> I think you are ignoring two key features of a sand hourglass:
>
> 1. The sand flows at a more-or-less even rate if the top is not empty.
>
> 2. You can turn it over at any time, even if the top is not yet empty.
>
> Suppose you start a M-minute timer (M>1) with all the sand in the top,
> wait one minute, and then turn it over. The top now contains the amount
> of sand that takes one minute to flow to the bottom, and it will empty
> in one more minute.

While this is clearly the right answer to the puzzle I wonder how
accurate feature (1.) actually is. Does anyone have - say - a three
minute egg timer to hand who'd try the actual experiment of running it
for one minute, reversing it and seeing how long it takes to return?

I'm not prepared to speculate on whether increased pressure might push
the sand through faster or make it pack together and flow less freely.
--
Online waterways route planner | http://canalplan.eu
Plan trips, see photos, check facilities | http://canalplan.org.uk

Frederick Williams

unread,
Jan 2, 2012, 12:18:44 PM1/2/12
to
RichD wrote:
>
> You're given a 7 minute, and a 4 minute, sand
> hourglass. Measure a 9 minute interval, in the first
> 9 minutes. (no 'setup' period)

Take the 7 minute and 4 minute sand hourglasses to an hourglass shop.
Trade them in for a 9 minute hourglass.

--
When a true genius appears in the world, you may know him by
this sign, that the dunces are all in confederacy against him.
Jonathan Swift: Thoughts on Various Subjects, Moral and Diverting

Mark Brader

unread,
Jan 2, 2012, 6:40:38 PM1/2/12
to
Rich Delaney:
> > You're given a 7 minute, and a 4 minute, sand
> > hourglass. Measure a 9 minute interval, in the first
> > 9 minutes. (no 'setup' period)

Frederick Williams:
> Take the 7 minute and 4 minute sand hourglasses to an hourglass shop.
> Trade them in for a 9 minute hourglass.

"If you don't time 9 minutes on your watch for me, I'll smash these
hourglasses into your face."
--
Mark Brader | "Have you got anything without Spam in it?"
Toronto | "Well, there's Spam, egg, sausage, and Spam.
m...@vex.net | That's not got *much* Spam in it." --Monty Python

Remysun

unread,
Jan 2, 2012, 8:10:31 PM1/2/12
to
On Dec 31 2011, 10:21 pm, William Elliot <ma...@rdrop.com> wrote:
> On Sat, 31 Dec 2011, RichD wrote:
> > You're given a 7 minute, and a 4 minute, sand
> > hourglass.  Measure a 9 minute interval, in the first
> > 9 minutes.  (no 'setup' period)
>
> Can't be done without a setup.

Start both timers. When the four minute is halfway through, stop the
seven minute. Proceed pouring the rest of the seven when the four is
expired.

BartC

unread,
Jan 2, 2012, 8:12:44 PM1/2/12
to


"Remysun" <remys...@yahoo.com> wrote in message
news:ffe240d6-3b3d-4bbc...@v13g2000yqc.googlegroups.com...
> On Dec 31 2011, 10:21 pm, William Elliot <ma...@rdrop.com> wrote:
>> On Sat, 31 Dec 2011, RichD wrote:
>> > You're given a 7 minute, and a 4 minute, sand
>> > hourglass. Measure a 9 minute interval, in the first
>> > 9 minutes. (no 'setup' period)
>>
>> Can't be done without a setup.
>
> Start both timers. When the four minute is halfway through

You can't do that. You don't know when it will be exactly half-way.

--
Bartc

RichD

unread,
Jan 2, 2012, 8:37:40 PM1/2/12
to
On Jan 2, m...@vex.net (Mark Brader) wrote:
> > > You're given a 7 minute, and a 4 minute, sand
> > > hourglass.  Measure a 9 minute interval, in the first
> > > 9 minutes.  (no 'setup' period)
>
> > Take the 7 minute and 4 minute sand hourglasses to
> > an hourglass shop.
> > Trade them in for a 9 minute hourglass.
>
> "If you don't time 9 minutes on your watch for me, I'll smash these
> hourglasses into your face."

Cute.

Do you remember the story of the mythical
chem student, who was given a barometer, and
asked to determine the height of a buildng?

--
Rich

Mark Brader

unread,
Jan 3, 2012, 12:45:10 AM1/3/12
to
Mark Brader:
> > "If you don't time 9 minutes on your watch for me, I'll smash these
> > hourglasses into your face."

Rich Delaney:
> Do you remember the story of the mythical
> chem student, who was given a barometer, and
> asked to determine the height of a buildng?

Well, duh -- where'd you think I got that from?
--
Mark Brader, Toronto, m...@vex.net
"sci fi: the plural of scum fum" -- Spider Robinson

Dmitry A. Kazakov

unread,
Jan 3, 2012, 4:06:20 AM1/3/12
to
Wasn't it a thermometer and a stopwatch?

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Robert Wessel

unread,
Jan 3, 2012, 4:37:00 AM1/3/12
to
On Mon, 02 Jan 2012 16:17:55 +0000, Dr Nick
<3-no...@temporary-address.org.uk> wrote:

>Patricia Shanahan <pa...@acm.org> writes:
>
>> I think you are ignoring two key features of a sand hourglass:
>>
>> 1. The sand flows at a more-or-less even rate if the top is not empty.
>>
>> 2. You can turn it over at any time, even if the top is not yet empty.
>>
>> Suppose you start a M-minute timer (M>1) with all the sand in the top,
>> wait one minute, and then turn it over. The top now contains the amount
>> of sand that takes one minute to flow to the bottom, and it will empty
>> in one more minute.
>
>While this is clearly the right answer to the puzzle I wonder how
>accurate feature (1.) actually is. Does anyone have - say - a three
>minute egg timer to hand who'd try the actual experiment of running it
>for one minute, reversing it and seeing how long it takes to return?
>
>I'm not prepared to speculate on whether increased pressure might push
>the sand through faster or make it pack together and flow less freely.


It's actually fairly accurate - (dry) sand isn't a fluid, and most of
the (solid) sand grains are held up by being stacked on top of other
(solid) sand grains. The bits that fall are the ones that no longer
have any support, which are basically in a conical area with the base
over the hole in the neck of the hourglass (as those on the edges of
the cone fall, they open space above for more sand to shift down).

Now if the sand were not dry, or the grains weren't fairly consistent
in size or were excessively shaped to link to each other*, or the hole
was very small (or too large), you'd get more oddities in the flow
rates with changes in pressure.


*The quality of the "sand" is a significant issue in hourglass
accuracy (ideally you want smooth round grains of consistent size),
and many materials other than silica sand are used as well

Thomas Mlynarczyk

unread,
Jan 3, 2012, 6:47:22 AM1/3/12
to
Frederick Williams schrieb:
> Take the 7 minute and 4 minute sand hourglasses to an hourglass shop.
> Trade them in for a 9 minute hourglass.

... plus a 2 minute hourglass just to make the deal fair.

Greetings,
Thomas

--
Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)

Thomas Mlynarczyk

unread,
Jan 3, 2012, 6:51:35 AM1/3/12
to
RichD schrieb:
>> "If you don't time 9 minutes on your watch for me, I'll smash these
>> hourglasses into your face."
>
> Cute.
>
> Do you remember the story of the mythical
> chem student, who was given a barometer, and
> asked to determine the height of a buildng?

Never heard of that one. So what did he do? "If you don't tell me the
height of the building, I'll smash this barometer into your face"? Or
did he drop it from the top and measure the time until it hit the ground
and then compute the height from that?

BartC

unread,
Jan 3, 2012, 7:59:45 AM1/3/12
to


"Mark Brader" <m...@vex.net> wrote in message
news:7c2dnTN6lJrr3Z_S...@vex.net...
> Rich Delaney:
>> > You're given a 7 minute, and a 4 minute, sand
>> > hourglass. Measure a 9 minute interval, in the first
>> > 9 minutes. (no 'setup' period)
>
> Frederick Williams:
>> Take the 7 minute and 4 minute sand hourglasses to an hourglass shop.
>> Trade them in for a 9 minute hourglass.

That requires 'setup'. (But if the shop isn't too far, set the 7-minute one
going as soon as you set off, and swap the 4-minute one for a 2-minute one
in the shop. Set it going when the 7-minute one runs out.)

(Sorry can't see FW's actual post.)

--
Bartc

Frederick Williams

unread,
Jan 3, 2012, 8:22:40 AM1/3/12
to
RichD wrote:

> Do you remember the story of the mythical
> chem student, who was given a barometer, and
> asked to determine the height of a buildng?

Yes. I heard the late Clement Freud recount it as if it were fact.
Truth or myth, it's an entertaining story.

Nicolas Neuss

unread,
Jan 3, 2012, 12:07:42 PM1/3/12
to
Thomas Mlynarczyk <tho...@mlynarczyk-webdesign.de> writes:

> RichD schrieb:
>>> "If you don't time 9 minutes on your watch for me, I'll smash these
>>> hourglasses into your face."
>>
>> Cute.
>>
>> Do you remember the story of the mythical
>> chem student, who was given a barometer, and
>> asked to determine the height of a buildng?
>
> Never heard of that one. So what did he do? "If you don't tell me the
> height of the building, I'll smash this barometer into your face"? Or
> did he drop it from the top and measure the time until it hit the
> ground and then compute the height from that?

http://www.jokelibrary.net/education/physics2.html#finding_height_with_a_barometer

Nicolas

Thomas Mlynarczyk

unread,
Jan 3, 2012, 3:58:52 PM1/3/12
to
Nicolas Neuss schrieb:
>
http://www.jokelibrary.net/education/physics2.html#finding_height_with_a_barometer

Thanks :-)

Greetings,
Thomas

--
Ce n'est pas parce qu'ils sont nombreux � avoir tort qu'ils ont raison!
(Coluche)

RichD

unread,
Jan 3, 2012, 6:05:25 PM1/3/12
to
On Dec 31 2011, root <NoEM...@home.org> wrote:
> > You're given a 7 minute, and a 4 minute, sand
> > hourglass.  Measure a 9 minute interval, in the first
> > 9 minutes.  (no 'setup' period)
>
> > this is trivial.
> > So, given hourglasses of n and m minutes:
>
> > 1)  Can you devise a formula which generates a list of
> >   all possible intervals produced by them?
>
> > 2)  And an algorithm, which generates the interval,
> >   for any given number on the list.
>
> > Of course, this is solvable via brute force, but we
> > want something efficient.
>
> This problem is very interesting. After you realize
> how to get 9 minutes, you then realize you are
> able to get 4 minutes, 7 minutes, and then every
> integer minute thereafter. So the numbers realizable
> without delay are:
> 4,7,8,9,10,11,
> Then, clearly, with a 7 minute delay you can generate
> every integer minute.

Good.

So, as soon as you construct a small differential
between the units, you can repeat that interval
indefinitely. In this example, after 8 mintes, we
have a 1 minute timer, whcih can generate any
minute thereafter.

However, this isn't always possible. Consider
any 2 even minute hourglasses - we cannot time
any odd length interval. But is it guaranteed we
can eventually construct a 2 minute timer?

It seems that number theory must become a factor,
and prime numbers the key.

--
Rich

Daniel Pitts

unread,
Jan 3, 2012, 6:19:54 PM1/3/12
to
Without having done any analysis, I think specifically that the LCD is a
key to the intervals, which may lead to the general solution.



PT

unread,
Jan 4, 2012, 3:28:12 PM1/4/12
to
LCD?

It strikes me as structurally similar to the knapsack
problem: the hourglasses corrrespond to the
various size sticks. It would be extremely
interesting, perhaps a new result, to demonstrate
an isomorphism, reducing any hourglass instance
to a knapsack problem.

Considering the amount of work done in this area,
if this hourglass thing really is NP-complete, I
suspect someone would have discovered it
heretofore -


---
Paul T.

Daniel Pitts

unread,
Jan 4, 2012, 4:44:49 PM1/4/12
to
I doubt it is isomorphic to the knapsack problem, because you can "cut"
any one length of time by a multiple of the other length of time.

Dave Dodson

unread,
Jan 5, 2012, 1:55:07 AM1/5/12
to
On Jan 3, 5:19 pm, Daniel Pitts <newsgroup.nos...@virtualinfinity.net>
wrote:

> Without having done any analysis, I think specifically that the LCD is a
> key to the intervals, which may lead to the general solution.

It is probably the GCD, not the LCD. GCD(4,7) = 1, meaning that you
can hit every integer beyond a certain one, in this case beyond 6.

If the GCD(t1,t2) = 2, e.g., then you won't be able to hit any odd
integers. Etc.

Dave

Daniel Pitts

unread,
Jan 5, 2012, 2:55:15 AM1/5/12
to
Indeed, I meant GCD, though I typed the wrong thing :-) Thanks for the
correction.

Although, I don't see how you would get 6 with 4 and 7. The possible
values are 4,7,8,9...

Another potentially interesting problem would be "how to get to n with
the fewest turns"

Harry Vaderchi

unread,
Jan 5, 2012, 5:06:04 AM1/5/12
to
7-4=3
twice 3 is 6.

HTH

--
[dash dash space newline 4line sig]

Albi CNU

BartC

unread,
Jan 5, 2012, 8:44:25 AM1/5/12
to


"Harry Vaderchi" <ad...@127.0.0.1> wrote in message
news:op.v7lvoebf1r0rdn@dell3100...
If you're stilling talking about hourglasses, then yes the difference the 4
minute and 7 minute timers is 3 minutes.

But to get 6 minutes, you might have to start the process again, and you
will get the second 3 minutes starting 4 minutes later.

So not only has the '6' minutes actually taken 10 (try using that to boil an
egg), but there was a setup time of 4 minutes. A long time to wait for
breakfast.

--
Bartc

Frederick Williams

unread,
Jan 5, 2012, 9:09:14 AM1/5/12
to
RichD wrote:
>
> You're given a 7 minute, and a 4 minute, sand
> hourglass.

What may one do with these hourglasses? Turn them over, certainly, but
may one place them on their side so that they stop "ticking"?

Patricia Shanahan

unread,
Jan 5, 2012, 11:13:51 AM1/5/12
to
BartC wrote:
>
>
> "Harry Vaderchi" <ad...@127.0.0.1> wrote in message
> news:op.v7lvoebf1r0rdn@dell3100...
>> On Thu, 05 Jan 2012 07:55:15 -0000, Daniel Pitts
>> <newsgrou...@virtualinfinity.net> wrote:
>
>>> Although, I don't see how you would get 6 with 4 and 7. The possible
>>> values are 4,7,8,9...
>>>
>>> Another potentially interesting problem would be "how to get to n
>>> with the fewest turns"
>>>
>> 7-4=3
>> twice 3 is 6.
>
> If you're stilling talking about hourglasses, then yes the difference
> the 4 minute and 7 minute timers is 3 minutes.
>
> But to get 6 minutes, you might have to start the process again, and you
> will get the second 3 minutes starting 4 minutes later.

No. When four minute timer expires, turn it over and declare the start
of the six minute period. When the seven minute timer expires, the four
minute timer has three minutes worth of sand in the lower chamber. Turn
it over to time the second three minutes.

You do have a four minute set-up period, which fails to follow the
original requirement of no set-up time, but it does get a continuous six
minutes.

Patricia Shanahan

unread,
Jan 5, 2012, 11:17:57 AM1/5/12
to
Frederick Williams wrote:
> RichD wrote:
>> You're given a 7 minute, and a 4 minute, sand
>> hourglass.
>
> What may one do with these hourglasses? Turn them over, certainly, but
> may one place them on their side so that they stop "ticking"?
>

Could someone with an actual hourglass check whether that works? I would
have thought that most of the time the level of sand in one side would
still be above the hole. If so, does the sand really stop flowing?

Patricia

Frederick Williams

unread,
Jan 5, 2012, 11:27:46 AM1/5/12
to
I have a three minute egg timer the sand in which stops flowing when it
is laid on its side even when most of the sand is in one bulb. And even
if it didn't, one can place it a little off the horizontal so that the
greater part of the sand falls back from the hole a little, but the rest
of the sand (the lesser amount) does not get near the hole. That this
works may be because of the shape of the bulbs and YBSMV.

I write "sand", but it is some finely divided green stuff.

Daniel Pitts

unread,
Jan 5, 2012, 2:55:04 PM1/5/12
to
On 1/5/12 8:13 AM, Patricia Shanahan wrote:
> BartC wrote:
>>
>>
>> "Harry Vaderchi" <ad...@127.0.0.1> wrote in message
>> news:op.v7lvoebf1r0rdn@dell3100...
>>> On Thu, 05 Jan 2012 07:55:15 -0000, Daniel Pitts
>>> <newsgrou...@virtualinfinity.net> wrote:
>>
>>>> Although, I don't see how you would get 6 with 4 and 7. The possible
>>>> values are 4,7,8,9...
>>>>
>>>> Another potentially interesting problem would be "how to get to n
>>>> with the fewest turns"
>>>>
>>> 7-4=3
>>> twice 3 is 6.
>>
>> If you're stilling talking about hourglasses, then yes the difference
>> the 4 minute and 7 minute timers is 3 minutes.
>>
>> But to get 6 minutes, you might have to start the process again, and
>> you will get the second 3 minutes starting 4 minutes later.
>
> No. When four minute timer expires, turn it over and declare the start
> of the six minute period. When the seven minute timer expires, the four
> minute timer has three minutes worth of sand in the lower chamber. Turn
> it over to time the second three minutes.
>
> You do have a four minute set-up period, which fails to follow the
> original requirement of no set-up time, but it does get a continuous six
> minutes.
>
Indeed, if you allow set-up, you can get every integer with 7 minute and
4 minute times!

You could actually set-up once to get "one minute" left on either timer,
and then from that point forward, you never need to set up again, for
any other experiment. Of course, for real-world applications having to
"turn over two hourglasses" every minute (on the minute!) would be more
distracting than helpful. Hence my suggestion that the interesting
problem is "using the fewest turns, how do you get 'n' minutes". With
or without set up is acceptable to me.

Daniel Pitts

unread,
Jan 5, 2012, 2:57:05 PM1/5/12
to
I would suspect it depends on the shape of the bulbs, but I have seen
that technique used in real life situations. For instance, "pausing" a
game while someone uses the restroom or answers the door.

Dave

unread,
Jan 5, 2012, 6:37:36 PM1/5/12
to
On Jan 5, 1:55 am, Daniel Pitts <newsgroup.nos...@virtualinfinity.net>
wrote:
> On 1/4/12 10:55 PM, Dave Dodson wrote:> On Jan 3, 5:19 pm, Daniel Pitts<newsgroup.nos...@virtualinfinity.net>
> > wrote:
>
> >> Without having done any analysis, I think specifically that the LCD is a
> >> key to the intervals, which may lead to the general solution.
>
> > It is probably the GCD, not the LCD. GCD(4,7) = 1, meaning that you
> > can hit every integer beyond a certain one, in this case beyond 6.
>
> > If the GCD(t1,t2) = 2, e.g., then you won't be able to hit any odd
> > integers. Etc.
>
> > Dave
>
> Indeed, I meant GCD, though I typed the wrong thing :-) Thanks for the
> correction.
>
> Although, I don't see how you would get 6 with 4 and 7.  The possible
> values are 4,7,8,9...

"Beyond 6" does not include 6.

Dave

Daniel Pitts

unread,
Jan 5, 2012, 7:02:56 PM1/5/12
to
Ah, indeed.

JohnF

unread,
Jan 5, 2012, 11:40:40 PM1/5/12
to
In sci.math Daniel Pitts <newsgrou...@virtualinfinity.net> wrote:
> [...] Hence my suggestion that the interesting problem is
> "using the fewest turns, how do you get 'n' minutes".

Not obvious that complexity theory (or accumulated error)
thrown into the "hourglass instruction set" really adds
anything of abstract interest. But it did originally seem
to me like the "language" might have interesting semantics
until someone pointed out you could measure four minutes
and then every minute after (and including) seven, with
just the 4- and 7-minute timers. So the "computable set"
of times is pretty trivial, being N\{1,2,3,5,6}.
Is there any way to make it more interesting?
For example, suppose you're only allowed to reset the timer
after it runs out. Does that make the computable times
more interesting? Is there any way to make it more interesting?
If so, then a question about the "algebra" occurred to me,
as follows. Suppose you have a set S1={k1,t1, k2,t2, ..., kn,tn}
meaning k1 hourglasses that time t1, ..., through kn that time tn.
And suppose that allows you to "compute" times T1={some set of times}.
Then T1 is the "semantics" of S1. And suppose you also have an
S2,T2. How do they (algebraically) combine? That is,
what's the T for S1\/S2 (the set-theoretic "or"), and
what's the T for S1/\S2 (the set-theoretic "and") of the S's?
And how do these T's relate to T1 and T2.
Of course, you first need an instruction set that
gives rise to non-trivial T's (subsets of N) in the first place,
if that's possible. If not, is there some kind of
instruction set that does? I'd imagine so, but couldn't
figure out what to google.
--
John Forkosh ( mailto: j...@f.com where j=john and f=forkosh )

JohnF

unread,
Jan 6, 2012, 1:42:22 AM1/6/12
to
In sci.logic Patricia Shanahan <pa...@acm.org> wrote:
> Frederick Williams wrote:
>> RichD wrote:
>>> You're given a 7 minute, and a 4 minute,
>>> sand hourglass.
>>
>> What may one do with these hourglasses?
>> Turn them over, certainly, but may one place
>> them on their side so that they stop "ticking"?
>
> Could someone with an actual hourglass check whether that works?

What's the diff? As per my preceding post, the more
interesting abstract problem is: given a particular
"instruction set" (that's apparently not Turing
complete), what's the "computable" subset of N?
Here, the available hourglasses are maybe like
registers or memory locations (I'm not sure what
a good computer analogy would be here), and the
turn-over operations are like the instruction set.
The contents of these "memory locations" aren't
really bits, or even bit-like, and so the instructions
don't do the usual things, and therefore presumably
don't have the usual semantics (though it seems
pretty easy to associate them with subsets of N).
What seems interesting to me is to try to firm up
this kind of analogy, and see if anything worth
talking about emerges.
0 new messages