An airplane with n seats is fully booked, and every passenger has been assigned a specific seat. However, the first passenger to board ignores their assignment and chooses a seat at random. The second and all subsequent passengers sit in their assigned seat if it is unoccupied when they board. Otherwise, they choose an empty seat at random. What is the probability that the kth passenger gets their assigned seat?
I created a C++ program that simulates the above process and finds the approximate probability for each passenger. The program is up at my GitHub.