a very nice problem

Nov 08, 2010 22:24

A train moves along the real number line with constant integer velocity and starts out at t=0 at an integer. At each time t=0,1,2,..., you are able to check whether the train is at a single integer of your choosing (which may be a different choice each time). Explain how it is possible to determine the train's velocity and starting position.

Leave a comment

Comments 9

dnwq November 9 2010, 04:45:55 UTC
It seems that being able to identify the train's position at any t implies being able to do it again, which would allow both velocity and starting position.

As for identifying said position: the set {m,n} for integer m,n is countable. And the train's position at any t is only determined by t and the two unknown integers. I'll be damned if I sketch out a mapping at 5am in the morning, though.

Reply

dnwq November 9 2010, 04:47:01 UTC
*set notation is probably wrong

5am 5am 5am

Reply

cjqsg November 9 2010, 13:42:05 UTC
right idea. its quite trivial once u get the idea but if u dont get the idea, you will be spending a lot of time/effort trying to cover all possible movements of the train. the latter approach is certainly workable in principle but it is hard to see how a solution motivated by that approach will look like.

Reply

joechee November 9 2010, 14:00:57 UTC
Actually my solution does not involve mapping. Essentially since the train's velocity is countable, you can essentially brute-force the solution out by testing velocities: 0 (base cases are impt!), 1, -1, 2, -2, 3, -3, 4, -4, 5, -5 (essentially I'm interleaving positive and negative numbers (which is arguably where the mapping comes in)

So what happens is that when you want to test a velocity, you would use the function position(v,t) = v * t (which happens to be a one-to-one function) to test whether the train is at position(v,t).

Infinite countable sets are irritating things, though.

Reply


Leave a comment

Up