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 = [ ["0","0"], ["1","1"], ["2","2"], ["3","E_"], ["4","H_"], ["5","5"], ["6","9"], ["7","L_"], ["8","8"], ["9","6"]] 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: valid_options.append(flip(val)) return len(valid_options) x,y = [],[] for i in range(1,9): x.append(i) y.append(find_all_digits(i)/10**i) fig = plt.figure() ax = fig.add_subplot(111) plt.scatter(x,y) for i,j in zip(x,y): ax.annotate("("+str(i)[:4]+","+str(int(round(j*10**i)))+")",xy=(i-0.075*len(str(round(j*10**i))),j+0.01)) 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') plt.show()
Pingback: Time For Some Abstract Math. Drink Up. - NewsCasper
Pingback: Time For Some Abstract Math. Drink Up.
Pingback: Time For Some Abstract Math. Drink Up. - FiveThirtyEight - Nevin Manimala
Pingback: who else really gets Quizzes ? – Its Trivia Time
Pingback: Important Post – Its Trivia Time
Pingback: love the fanpage – Its Trivia Time
Pingback: Anything related to this is so important – Its Trivia Time