The probability, p(n), of getting a free ticket when you are the nth person is line is:
(probability that none of the first n−1 people share a birthday) · (probability that you share a birthday with one of the first n−1 people)
So p(n) = [1 · 364/365 · 363/365 · ... · (365−(n−2))/365] · [(n−1)/365], where we require n 365.
p(n)/p(n+1) = 365/(366−n) · (n−1)/n
Now, p(n)/p(n+1) > 1 365n − 365 > 366n − n2, and so n2 − n > 365.
Completing the square, we get (n − ½)2 - ½2 > 365.
Rejecting the negative region, inequality is satisfied if n − ½ > 365.25 19.1.
Therefore the position in line that gives you the best chance of being the first duplicate birthday is 20th.
Note that, although this is the best position in line, it offers only about a 1/31 chance of getting the free ticket! The histogram below shows the probability, p, of being the first duplicate birthday for each position in line from 2nd to 60th. The probability distribution is asymmetrical: it increases quite rapidly from 1/365 for 2nd in line, to about 0.0323 for 20th in line, and then slowly decreases, so that the probability when 54th in line is roughly equal to that when 2nd.