Exciting coincidence!

California’s license-plate scheme is

digit-letter-letter-letter-digit-digit-digit

We can consider this as a number written with one base-10 digit followed by three base-26 digits (where A is 0, B is 1, C is 2, etc.) followed by three more base-10 digits. It’s easy to convert such a sequence to a pure base-10 number. For instance, 0AAA000 is 0. 0AAA001 is 1. 0AAA002 is 2. And so on up through 0AAA999, which is 999, and then to 0AAB000, which is 1,000. 0AAC000 is 2,000. 0AAZ000 is 25,000. 0AAZ999 is 25,999, and 0ABA000 is 26,000. And so on.

Here is a short Python function that does the conversion:

def plate_to_number(sequence):
  result = 0
  for character in sequence:
    if character.isdigit():
      result = result * 10 + int(character)
    elif character.isalpha():
      character = character.lower()
      result = result * 26 + (ord(character) - ord('a'))
  return result

My first license plate on moving to California in 1992 was 2ZZZ923, whose number value is 52,727,923. Now here’s the exciting coincidence: the number value of my current license plate, from 2007, is almost exactly double that (to within an error of 0.014%)!

Well, it’s exciting to nerds.

One thought on “Exciting coincidence!

Leave a Reply