This has to do with last week’s Puzzler on The Best of Car Talk. Here is the puzzler…
A plane has 100 seats and 100 passengers are boarding with assigned seats.
The first passenger to board looses their ticket and, sits in a random seat.
Subsequent passengers board and, if their seat is already taken, they
find an available seat at random.
What are the odds that YOU (being the last person to board the plane) will sit in your assigned seat?
The answer was, I think, 50% and the logic seemed pretty fuzzy to me. SO… I wrote up a MatLab program to iteratively test it out. With a large number of runs (100000) the answer was that 66% of the time (2 out of 3) you seat in your assigned seat.
Did I just mis-hear the Car Talk answer or were Tom and Ray WRONG!!!
Here is my MatLab program:
% THE PUZZLE
% A plane has 100 seats and 100 passengers are boarding with assigned seats.
% The first passenger to board looses their ticket and, sits in a random seat.
% Subsequent passengers board and, if their seat is already taken, they
% find an available seat at random.
% THE CHALLENGE
% What are the odds that YOU (being the last person to board the plane)
% will sit in your assigned seat?
TheResult = zeros(Ntimes,1); % pre-allocate the array
% Run the PUZZLE a bunch of times for better statisical results
% All the passengers have their tickets and assigned seats
SeatAssignment = 1:100;
% Keep track of which seats are taken during the process of boarding the plane
SeatFilled = zeros(100,1);
% Passenger #1 looses their ticket and sits in a random seat RandomSeat = Rand_1to100(); SeatFilled(RandomSeat) = 1; % The next 98 passengers seat down for p=2:98 TheSeatNumber = SeatAssignment(p); % Is someone sitting in passenger seat? if SeatFilled(TheSeatNumber)==1 % Find a randomly OPEN seat and take it while SeatFilled(TheSeatNumber)==1 TheSeatNumber = Rand_1to100(); end end SeatFilled(TheSeatNumber) = 1; end % The result is the whether YOUR seat (being passenger #100) is taken if SeatFilled(100)==0 TheResult(n) = 1; % My Seat Is Empty!!! Yeah!!! else TheResult(n) = 0; % My Seat Is Already Taken!!! Yuck!!! end
TheOdds = sum(TheResult)/Ntimes;
% Create a random number between 1 and 100
TheNumber = floor(100*(rand(1,1))+1);
% Limit the number to between 1 and 100
TheNumber = max(1,min(100,TheNumber));