7/L Segment Display

Today I was troubleshooting a sensor that was giving an error code — but Error 52 “Over Voltage” was not what I expected… regardless I checked the voltage and it looked fine. About ten minutes later I realized that the display was mounted upside down and it was Error 25, “Programming Error” — duh.



Which one? Choose wisely


While this is totally my fault it is also avoidable. So if you are a company that makes things with important codes using a seven segment display AND your display can logically be upside down then don’t use any numbers that are also valid in either orientation.




Here are the amount of numbers that satisfy that criteria:


To find this I used the criteria of a number having to be not a number upside down (because of a 7, 4 or 3) or be itself when upside down (96 -> 96).

1 Digit Numbers
2 Digit Numbers
3 Digit Numbers
4 Digit Numbers
5 Digit Numbers


Here is the code:

import matplotlib.pyplot as plt

def flip(num):
    flips = [

    new_num = ""
    for i in range(len(num)):
        new_num += flips[int(num[len(num)-1-i])][1]
    if new_num == num or len(new_num) > len(num): return num
    else: return

def find_all_digits(digits):
    valid_options = []
    for i in range(0,10**digits):
        val = str(i)
        val = "0"*(digits-len(val))+val
        if flip(val) is not None:
    return len(valid_options)

x,y = [],[]
for i in range(1,9):

fig = plt.figure()
ax = fig.add_subplot(111)
for i,j in zip(x,y):
plt.title("Number of valid numbers that aren't confusing when upside down")
plt.xlabel("N\n Number of Digits Used")
plt.ylabel('Valid Entries / Total Possible Entries')


7 thoughts on “7/L Segment Display

  1. Pingback: Time For Some Abstract Math. Drink Up. - NewsCasper

  2. Pingback: Time For Some Abstract Math. Drink Up.

  3. Pingback: Time For Some Abstract Math. Drink Up. - FiveThirtyEight - Nevin Manimala

  4. Pingback: who else really gets Quizzes ? – Its Trivia Time

  5. Pingback: Important Post – Its Trivia Time

  6. Pingback: love the fanpage – Its Trivia Time

  7. Pingback: Anything related to this is so important – Its Trivia Time

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s