# Greatest Digital Clock Number, with a Twist!

7 segments make up a number, some visible, some invisible. Just like on a digital clock:

88:88 or 04:00: There are 2 vertical segments on both sides and 3 horizontal segments in the center.

What's the largest number you can form, where it has the same number of visible segments as the number it represents.

For example 4 is formed with 4 visible segments on a digital clock.

Or 5 which has 5 visible segments.

How large can these numbers get, and which is the largest?

Note: The number can have as many digits as you wish

Your answer is only valid if you state the answer, and how you came to the conclusion!

6 is the largest number where it represents the number of segments.

First, we can put an upper bound on our answer. At most, we have a two digit number. This is because the smallest three digit number (100) is an order of magnitude more than the maximum number of displayed segments ($$21 = 7\times3$$).

Through a process of elimination, we can work backwards from the largest possible 2 digit number: 14 ($$=7\times2$$).

We end up with $$6$$ being the largest number.

Infinite

If we can front-pad the number with zeros, we can get to infinity, but only certain numbers. This is because each zero we add in front of the number is 6 additional segments.

For example, $$0...0400$$ can be made with 114 leading zeros. $$(114+2)\times6+4 = 400$$.

In fact, there's a limited set of numbers that answer this. We know these numbers are greater than six, and we know their remainder when divided by six is equal to the sum of their segments mod 6.

Let $$N$$ be the number, and $$s_n$$ be the number of segments of the $$n$$th digit.

$$\left(\sum s_n\right) \mod 6 = N\mod6$$

Any number of the form $$0...06...6$$ will work (assuming enough zeros). Also, any number of the form $$0...040...0$$.

Some things I've worked out:

1. $$N$$ is even, iff $$\sum s_n$$ is even. This is because zero has an even number of segments, and you can't add even numbers together to get odd numbers. The corollary to this is: $$N$$ is odd, iff $$\sum s_n$$ is odd. This may seem really obvious, but it helps tremendously.
2. 1, 2, 8, and 9 are "backwards" numbers. By this, I mean that they are even, but their number of segments is odd, or vice versa. This means that a number cannot only be made of 1s or 9s, and a number made solely of 2s and/or 8s must have an even number of 2s and 8s. A corollary of this is that a number made of solely "regular" odd numbers cannot have an even number of digits. (These numbers being 3, 5, and 7)

There are probably many other forms. I'd be interested to see a mathematician work through them all.

• This answer is actually better than the current accepted, because it explains the infinity part, good job! – warspyking Jan 26 '15 at 23:13
• @warspyking Well thankee! I'm working on a more rigorous formulation of the acceptable numbers. I'll update the question when I figure it out. – Nick2253 Jan 27 '15 at 0:00
• I look forward to that, let me know when you're finished with @ – warspyking Jan 27 '15 at 1:50
• @warspyking Unfortunately, I couldn't find a more succinct form for the answers. Since 3 isn't a factor of 10, there is no convenient repeating math here. – Nick2253 Jan 30 '15 at 15:27

I suppose this is also cheating? • Creative, but yea, kinda. – warspyking Jan 27 '15 at 17:42
• Well he never said you couldn't spell the number... English-dependent though. – smci Jan 27 '15 at 22:16
• Any idea what other numbers work that way, using either uppercase or lowercase, and possibly including "tall" versions of "aegnqr"? – supercat Jan 28 '15 at 16:28

This assumes you cannot null-pad the number, since if you can null-pad it, the highest number is infinite.

For a n-digit number, the maximum number of lines visible is 7n. Therefore, the number cannot be greater than 2 digits, since 21<100 for n = 3, and the number of lines increases linearly with n while the number increases exponentially with n.

The 2-digit number also cannot be greater than 14, since the maximum number of visible lines is 14.

14 - 6 lines

13 - 7 lines

12 - 7 lines

11 - 4 lines

10 - 8 lines

9 - 6 lines

8 - 7 lines

7 - 3 lines

6 - 6 lines

If null-padding is allowed, then any number that has follows the equation

(actualValue-lineCount)%6 == 0 will work.

For example:

13: 13-7 = 6, valid as 013

29999: 29999-29 = 29970, valid as (4995 zeros)29999

My digital clock is in

binary. It reads 100000, which uses 3210 line segments to display the number 3210.

Assuming we can't pad the answer to infinity with unnecessary zeroes, this seems to be the maximal answer, because

in any base, when we add an additional nth digit, the clock face value grows geometrically by (radix*n) while the line count grows arithmetically by at most 7. Clearly these values will diverge quickly; to maximize the point before they diverge, we want the most digits, and hence the lowest radix. Ergo, no base higher than 2 will yield a higher answer.

"What about a clock in base square root of two?"

Very devious approach! However, it doesn't turn out to yield a higher answer, or any valid answer at all. I can't think of a tidy number-theory way to address this, but I wrote a simple script to test and it turns out that

The highest solution from a square root base is 16 (202 in base sqrt(7)). Cube roots are left as an exercise for the student :)

• What about a clock in onfr fdhner ebbg bs gjb, or, more generally, onfr agu ebbg bs gjb, sbe a nf fbzr cbjre bs gjb? (decode) – wchargin Jan 27 '15 at 17:45
• Great question! I'll address it in an edit. – DevOfZot Jan 27 '15 at 18:23

Regarding only the maximum of 28 elements and 4 numbers, the highest element is 6 (without leading zeroes) and 22 (with leading zeroes : 00:22). Only regarding decimal system.

Since this is a digital clock, the leftmost digit only has six elements, which can display either 1 or 2. The upper left vertical segment is missing on clock displays. Therefore, the leftmost digit can only display 1, 2, 3, or 7. The lack of facility to display a 0 in the most significant position in a digital clock means the question as asked has no valid answer. Oh sure, 24-hour clocks. Pff. Who has them?

Taking a four-gang seven-segment display, with zero padding, the total number of segments is 28. With zero padding (not disqualified by the questioner) this means 0022 (6+6+5+5) is the highest number.

In other terms: Sa+Sb+Sc+Sd = 1000*A + 100*B + 10*C + D

S(0) + S(0) + S(2) + S(2) = 1000*0 + 100*0 + 10*2 + 2

6 + 6 + 5 + 5 = 1000*0 + 100*0 + 10*2 + 2

22

Taking a four-gang seven-segment display, with zero padding and a colon (as illustrated, although the missing segment in the second digit is a bit off), the total number of elements is 30. The highest number of elements for a display beginning 00:2 displays 00:28 and lights 6+6+2+5+7=26 elements.

• 00:27 lights 6+6+2+5+3=22
• 00:26 lights 6+6+2+5+6=25
• 00:25 lights 6+6+2+5+5=24
• 00:24 lights 6+6+2+5+4=23
• 00:23 lights 6+6+2+5+5=24
• 00:22 lights 6+6+2+5+5=24

There's no point going lower, since the colon in such a display flashes on and off, and so the highest number is again as above: 22. However, with the colon lit:

• 00:21 lights 6+6+2+5+2=21

This means that, with a flashing colon that is lit at 59 seconds and unlit at 0 seconds, a digital clock will display two consecutive "correct" answers at 21 and 22 minutes past midnight.