Project Euler 371: License plates
Oregon licence plates consist of three letters followed by a three digit number (each digit can be from [0..9]).
While driving to work Seth plays the following game:
Whenever the numbers of two licence plates seen on his trip add to 1000 that’s a win.
E.g. MIC-012 and HAN-988 is a win and RYU-500 and SET-500 too. (as long as he sees them in the same trip).
Find the expected number of plates he needs to see for a win.
Give your answer rounded to 8 decimal places behind the decimal point.
Note: We assume that each licence plate seen is equally likely to have any three digit number on it.
Project Euler 371 SolutionRuns < 0.001 seconds in Python 2.7.
Use this link to get the Project Euler 371 Solution Python 2.7 source.
AnswerSlowly swipe from either end beginning with the white vertical bar to get an idea of the starting or ending digits. For less drama, just double click the answer area. The distance between the two bars will give you an idea of the magnitude. Touch devices can tap and hold the center of the box between the two bars and choose define to reveal the answer.
- As these problems originate in the UK, the spelling of licence follows the convention in British English, Canadian English, Irish English, Australian English, and New Zealand English where the noun is spelled licence and the verb is license.
- Try this with 365 and think about what the significance the answer has.
- Other license plates with more digits:
- 4 digits: 126.340880766
- 5 digits: 397.335708939
- 6 digits: 1254.31507797
- 7 digits: 3964.32759492
- 8 digits: 12534.1414672
- 9 digits: 39634.2730058
- 10 digits: 125332.413741 (1.19 s)
- 11 digits: 396333.729764
- 12 digits: 1253315.13732
- 13 digits: 3963328.2966