Multiple solutions to mango tree with 7 gates puzzler


#1

2 is the best solution, but it’s not the only solution, contrary to what Tom & Ray said.

Pick any number (> 2) of mangoes you want to end up with, subtract 1, multiply by 2. Repeat 7 times. This is the number of mangoes to start with.

For example if you want to end with 3, start with 130: 3, 4, 6, 10, 18, 34, 66, 130.


#2

Yeah, keep listening and they admit this mistake. In fact, it becomes a running joke whenever Ray says he’s sure of some answer and Tom doubts him.

You can end up with any integer number of mangoes (>1).
The algebraic answer is y = 128x-254 where x = the number of mangoes you end up with and y = the number you have to pick off the tree.


#3

Now I know where that repeated clip came from.


#4

Yep, nest the function 2(x-1) seven times and you get the equation. The solution 2 works for any number of gates from 1 to infinity.


#5

It works when the number of mangoes that you bring to each gate gets divided in half and results in an odd number, thus when you add one back in you have an even number. This can be described as a recurrence. But since I did not learn enough the the math concepts class that I took twice, you can also generate answer using a database with structured query language or SQL.


SYS@dbmedia AS SYSDBA> SELECT starting_number, ending_number
  2    FROM ( SELECT n starting_number, ((((((((((((n/2+1)/2)+1)/2)+1)/2)+1)/2)+1)/2)+1)/2)+1 ending_number
  3             FROM ( SELECT rownum n
  4                      FROM all_objects
  5                     WHERE rownum < 1027 ) )
  6            WHERE TRUNC(ending_number) = ending_number;

STARTING_NUMBER ENDING_NUMBER
--------------- -------------
              2             2
            130             3
            258             4
            386             5
            514             6
            642             7
            770             8
            898             9
           1026            10

9 rows selected.

Elapsed: 00:00:00.02
SYS@dbmedia AS SYSDBA>
SYS@dbmedia AS SYSDBA> SELECT starting_number, ending_number
  2    FROM ( SELECT 128*n-254 starting_number, n ending_number
  3             FROM ( SELECT rownum+1 n
  4                      FROM all_objects
  5                     WHERE rownum < 10 ) )
  6            WHERE TRUNC(ending_number) = ending_number;

STARTING_NUMBER ENDING_NUMBER
--------------- -------------
              2             2
            130             3
            258             4
            386             5
            514             6
            642             7
            770             8
            898             9
           1026            10

9 rows selected.

Elapsed: 00:00:00.10

#6

Picking 130 mangos might be a better answer than two. I mean if the guards have guns … lol …


#7

he only picked 2 mango , he give half mango to each guard and took 1 mango back thats mean no guard get any mango he too 2 mango