A383739 Smallest number that, when displayed on a 7-segment display using A006942, leaves exactly n segments unused.
8, 0, 2, 4, 7, 1, 10, 12, 14, 17, 11, 101, 112, 114, 117, 111, 1011, 1112, 1114, 1117, 1111, 10111, 11112, 11114, 11117, 11111, 101111, 111112, 111114, 111117, 111111, 1011111, 1111112, 1111114, 1111117, 1111111, 10111111, 11111112, 11111114, 11111117, 11111111, 101111111
Offset: 0
Examples
a(1) is the smallest number with exactly 1 unused segment. The digit 0 uses 6 segments, leaving 1 unused, and since 0 is the smallest valid number, we have a(1) = 0. For a(6), we seek the smallest number with exactly 6 unused segments. No single-digit number meets this, as each digit leaves at most 5 segments unused. Among two-digit numbers, 10 is the smallest: '1' contributes 5 unused segments and '0' contributes 1, totaling 6. Therefore, a(6) = 10.
Links
- Index entries for linear recurrences with constant coefficients, signature (0,0,0,0,11,0,0,0,0,-10).
Programs
-
Python
def a(n): q, r = divmod(n, 5) if q == 0: return [8, 0, 2, 4, 7][r] if r == 0: return 10**q//9 if r == 1: return 91*10**(q-1)//9 return 10**(q+1)//9 + [1, 3, 6][r - 2]
Formula
For p>=1:
a(5*p) = (10^p-1)/9
a(5*p+1) = (91*10^(p-1)-1)/9
a(5*p+2) = (10^(p+1)-1)/9 + 1
a(5*p+3) = (10^(p+1)-1)/9 + 3
a(5*p+4) = (10^(p+1)-1)/9 + 6
Comments