Frictional Games Forum (read-only)
Riddles, brain puzzles and mathematical problems - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Frictional Games (https://www.frictionalgames.com/forum/forum-3.html)
+--- Forum: Off-Topic (https://www.frictionalgames.com/forum/forum-16.html)
+--- Thread: Riddles, brain puzzles and mathematical problems (/thread-19232.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29


RE: Riddles, brain puzzles and mathematical problems - Froge - 03-25-2014

So who here is good at CS?


RE: Riddles, brain puzzles and mathematical problems - Bridge - 03-25-2014

I have a reasonable grasp of programming concepts, but I'm no master.


RE: Riddles, brain puzzles and mathematical problems - BAndrew - 03-25-2014

(03-25-2014, 07:13 PM)Bridge Wrote: MyRedNeptune's, but the solutions are pretty similar.

You won't determine the bottle with the poison with only the last rat. It's the pattern of rats that will die that will help you. Maybe illustating the problem will help you? I don't quite understand what you don't get. Try doing it practically. Let's pick up random rats that are going to die and you will see that if you process the information (using one of the two methods) you will end up with a single bottle.

(03-25-2014, 07:15 PM)Froge Wrote: So who here is good at CS?

Assuming CS means computer science (and not counter strike or something else) then I am in some extent, but however all I know are things I read on my own on the net. I am not expert and have not completed a course.


RE: Riddles, brain puzzles and mathematical problems - MyRedNeptune - 03-25-2014

(03-25-2014, 07:09 PM)Bridge Wrote: Neither. The 10th rat drinks from 512 bottles just like the rest of them. At the end of the process, all you know is which 512 bottles contain the poison (e.g. you can rule out the other 512.) You still need to repeat the process until only two possibilities remain.

You're right that each rat drinks 512 bottles. But the pattern of the sampling means that every step rules out an additional half of the amount of bottles of the step before it, which after 10 steps rules out 2^9 + 2^8 + 2^7 + ... ... + 2^1 + 2^0 = 1023 bottles. The chart I attached illustrates this pattern:

[Image: chart.png]

Note that the darker cell colors mark the range of medicine sampled by a rat. You can see that that already on the 3rd step it is possible to tell which 128 bottles include the poison. It is not necessary to wait for the deaths to occur because our sampling pattern is constant. As an example, if the number of the poison bottle is 666, then 20 hours after the sampling rat 1 would be alive, rat 2 would be dead and rat 3 would be alive.


Here's a better way to look at it. This is essentially the same solution, but illustrated differently.

Let's write down 1024 as its 2-bit equivalent (10000000000) and label all the bottles accordingly.

Now, let's take 10 rats and assign to each rat a certain position in the number 10000000000, so that each rat only samples medicine in which there is a 0 at said position of its number. The following list illustrates this concept. The string of 11 characters represents the type of number assigned to each rat, where $ is any binary digit:

Code:
Rat 1 -   $0$$$$$$$$$
Rat 2 -   $$0$$$$$$$$
Rat 3 -   $$$0$$$$$$$
Rat 4 -   $$$$0$$$$$$
Rat 5 -   $$$$$0$$$$$
Rat 6 -   $$$$$$0$$$$
Rat 7 -   $$$$$$$0$$$
Rat 8 -   $$$$$$$$0$$
Rat 9 -   $$$$$$$$$0$
Rat 10 -  $$$$$$$$$$0

I think this list does a better job than the colored chart at showing how the poison will be found. Since we are using binary, there can only be either a 0 or a 1 at each position. The state of each rat after 20 hours will determine which one it is, and then we will have a full number which will be the number of the poisonous bottle.





@BAndrew (what's up with the new name? Tongue) - Hm, I'm having trouble understanding your solution. Which rats get which medicine? I'm a bit confused.

(03-25-2014, 06:29 PM)Titanomegistoterastiotatos Wrote: Actually he didn't meant to do this.

Also, part of this sentence is incorrect. Can you guess which?


RE: Riddles, brain puzzles and mathematical problems - BAndrew - 03-25-2014

(03-25-2014, 08:43 PM)MyRedNeptune Wrote: @BAndrew (what's up with the new name? Tongue) - Hm, I'm having trouble understanding your solution. Which rats get which medicine? I'm a bit confused.

(03-25-2014, 06:29 PM)Titanomegistoterastiotatos Wrote: Actually he didn't meant to do this.

Also, part of this sentence is incorrect. Can you guess which?


It doesn't matter which rats get which medicine (you do it however you want) as long as there is a "1-1" correspondence.
Every combination of rats corresponds to a bottle. (eg rat 1 + rat 2 + rat 5 corresponds to bottle 431 you decide how (it doesn't matter)). There are 1024>1000 possible combinations therefore after 20 hours you can check which rats died and then see which bottle they correspond to.

More mathematically defined:
a x combination of rats corresponds to a y bottle

A={1,1-2,1-2-3,1-5,5-7...}set of all combinations of rats
B={1,2,3,4,...1000} set of bottles

f:A-->B where f(x) = y
f is "1-1" which means that a x combination of rats corresponds to exactly one bottle and vice versa.




PS. wow I used didn't + meant in the same sentence. My grammar is perfect!


RE: Riddles, brain puzzles and mathematical problems - MyRedNeptune - 03-25-2014

(03-25-2014, 09:04 PM)BAndrew Wrote: It doesn't matter which rats get which medicine (you do it however you want) as long as there is a "1-1" correspondence.
Every combination of rats corresponds to a bottle. (eg rat 1 + rat 2 + rat 5 corresponds to bottle 431 you decide how (it doesn't matter)). There are 1024>1000 possible combinations therefore after 20 hours you can check which rats died and then see which bottle they correspond to.

More mathematically defined:
a x combination of rats corresponds to a y bottle

A={1,1-2,1-2-3,1-5,5-7...}set of all combinations of rats
B={1,2,3,4,...1000} set of bottles

f:A-->B where f(x) = y
f is "1-1" which means that a x combination of rats corresponds to exactly one bottle and vice versa.

Ah, I see. Essentially, it's the same as mine, but less specific and more broad, right?


(03-25-2014, 06:29 PM)Titanomegistoterastiotatos Wrote:
(03-25-2014, 08:43 PM)MyRedNeptune Wrote: @BAndrew (what's up with the new name? Tongue) - Hm, I'm having trouble understanding your solution. Which rats get which medicine? I'm a bit confused.

(03-25-2014, 06:29 PM)Titanomegistoterastiotatos Wrote: Actually he didn't meant to do this.

Also, part of this sentence is incorrect. Can you guess which?

PS. wow I used didn't + meant in the same sentence. My grammar is perfect!

Oh - I guess there's that, too. Lol. But, actually, what I wanted to say is that I'm a girl. Not a snide grammar Nazi. Tongue

Sorry for the inadvertent insult to your intelligence. ._.


RE: Riddles, brain puzzles and mathematical problems - BAndrew - 03-25-2014

(03-25-2014, 10:09 PM)MyRedNeptune Wrote: Ah, I see. Essentially, it's the same as mine, but less specific and more broad, right?

Exactly same idea, but more generalized.

(03-25-2014, 10:09 PM)MyRedNeptune Wrote: Oh - I guess there's that, too. Lol. But, actually, what I wanted to say is that I'm a girl. Not a snide grammar Nazi. Tongue


Ooops sorry. I don't even look at the gender most times and my biases made me assume that you are a male. Tongue

This is a tough one. It took me 1 hour to solve, but it is amazing! (you know when you solve it)

Find a natural number n>0 with the following property:
If we take the first degit and make it last (while keeping the other digits as they are) the number m we just made is the half of the first number n (or n = 2m).

For example if n = 2745 then m = 7452 but n=/= 2m. Therefore n is not the number we want.



NOTE: There are many such numbers n. All I ask is to give me one possible number n that satisfies the conditions.
NOTE2: Maths are not necessary to solve the problem(maybe a few basics only). If you know Maths then this will help you and there is a mathematical solution. But I guarantee that you don't have to know anything special.


RE: Riddles, brain puzzles and mathematical problems - MyRedNeptune - 03-26-2014

(03-25-2014, 10:14 PM)BAndrew Wrote: This is a tough one. It took me 1 hour to solve, but it is amazing! (you know when you solve it)

Find a natural number n>0 with the following property:
If we take the first degit and make it last (while keeping the other digits as they are) the number m we just made is the half of the first number n (or n = 2m).

For example if n = 2745 then m = 7452 but n=/= 2m. Therefore n is not the number we want.



NOTE: There are many such numbers n. All I ask is to give me one possible number n that satisfies the conditions.
NOTE2: Maths are not necessary to solve the problem(maybe a few basics only). If you know Maths then this will help you and there is a mathematical solution. But I guarantee that you don't have to know anything special.

Well, I got the number, but it's kind of big and my methodology is... questionable. :S

I'll try again tomorrow and if I can't get any better results I suppose I'll post it. Alternatively, I can share what I have discovered so far for critique.


RE: Riddles, brain puzzles and mathematical problems - BAndrew - 03-26-2014

Give me the number and explain your method. You don't have anything to lose.

The number is supposed to be big (really big)


RE: Riddles, brain puzzles and mathematical problems - MyRedNeptune - 03-26-2014

(03-26-2014, 02:28 AM)BAndrew Wrote: Give me the number and explain your method. You don't have anything to lose.

The number is supposed to be big (really big)

Spoiler below!

Let's suppose that a is equal to the first digit of n and b is equal to the number after the first digit of n. Now we can write a simple equation for one potential value of n:

n = 2m

10a + b = 2( 10b + a)
10a + b = 20b + 2a
19b = 8a

1 <= a <= 9 , so in this case we can definitely see that the equation has no solution. Let's look at some other variants:

100a + b = 2( 10b + a)
19b = 98a

1000a + b = 2(10b + a)
19b = 998a

10000a + b = 2(10b + a)
19b = 9998a

We can see that the coefficient of a changes with the assumed length of n. Finding the right coefficient will allow for a valid solution to be found. Let's label the coefficient c. Because c follows a particular pattern of growth, we can notice a pattern in its multiples with a:

998 * 2 = 1996
9998 * 2 = 19996
9998 * 4 = 39992
9998 * 8 = 79984
99998 * 8 = 799984

We see that the value of a determines the first digit and the last two digits of a*c, while the value of c affects the amount of 9's between them. Let's label the first digit of a*c as x and the last two digits of a*c as y. The table below shows the values of x and y that correspond to all possible values of a:

Code:
a     x     y
1     0     98
2     1     96
3     2     94
4     3     92
5     4     90
6     5     88
7     6     86
8     7     84
9     8     82

Because 19b = a*c , we know that a*c must be divisible by 19. Now we can pick any row from the table above and start progressively adding 9's between x and y until the resulting number can be divided by 19. Then we have found a*c, from which b, n and m can be found.

For example:

19b = 099999999999999998
b = 05263157894736842
a = 1
n = 105263157894736842
m = 52631578947368421

19b = 199999999999999996
b = 10526315789473684
a = 2
n = 210526315789473684
m = 105263157894736842