# How many digits can you create with only one seven segment display?

Let say you have a digital indicator which consists of seven lights as you see below. You are trying to make as many distinct digits as possible but there are two requirements for that:

• At least one light should be on to be counted as a shape.
• If more than one light is on, all lights are supposed to be connected directly or indirectly. (for example, all numbers in digital form are counted as digits.)

So, how many digits can you create with only one digital indicator?

• Is the 'o' formed by the top 4 lights considered to be the same digit as that formed by the bottom 4 lights? They look identical, as do many other digits, but most answers seem to be considering them separately. Commented Jul 26, 2016 at 0:04
• @Curmudgeon They do not look identical, at least not with the module as shown in the picture. The top and bottom segments have different shapes.
– pipe
Commented Jul 27, 2016 at 8:09
• @pipe OP never stated we were using the module in the picture ;) I see your point though; I was just hoping to get OP to clarify whether he meant total combinations or total visually distinct combinations Commented Jul 27, 2016 at 21:12
• @Curmudgeon i thought it was obvious that it was total combinations but good point and it needs to be clarified.
– Oray
Commented Jul 27, 2016 at 21:19
• @Oray It probably was, but the time I take something like that for granted is the time I go to a lot of effort to answer a question nobody was asking :p Commented Jul 27, 2016 at 22:25

There are

80 possibilities

Reason:

If the middle light is on, there are seven possibilities for both sides of the middle light. There are $2^3$ possibilities in total, but only turning the lowest or the highest light on breaks the connected requirement. So there are seven possibilities for either side, so $7\times7 = 49$ in total.

If the middle light is not on, there is a connected string of lights on. If we choose one of the six lights, we can turn on lights clockwise. We'll exclude the possibility that all lights but the middle one is turned on, so there are between 1 and 5 lights turned on and we can choose 6 lights where we begin. So this gives a total of $6\times5=30$ lights.

The final possibility is that all lights but the middle one is turned on, i.e. the zero shape.

This gives a total of $49+30+1=80$ possibilities.

• I don't think left | and right | can be counted as a separate digit. It would be used for human readers. So such confusions should be avoided. Commented Jul 26, 2016 at 11:53
• @akostadinov Indeed, the problem statement is very vague on what a "digit" means. I assume the OP was looking for total combinations of the 7-segment display. Commented Jul 26, 2016 at 20:17

@wythagoras and @Trenin have already provided correct answers to this puzzle, but for the sake of completeness, here is an explicit table of all possible digits, sorted by the number of segments turned on.

One can easily see that there are

80

possible configurations in total.

• I was hoping to have someone make a nice table... +1 to you! Commented Jul 26, 2016 at 0:42
• The first row appears to only have three distinct shapes. Or did I miss something? Commented Feb 8, 2021 at 21:13
• @IanMacDonald It's not about the invariant shape, but also about the position of the lit up segment. E.g., one segment at the top or one segment at the bottom is considered different. Commented Feb 9, 2021 at 5:48

NOTE: Too much for spoiler tags, so I only did the last.

EDIT: After all that work, I find out I have the same answer as wythagoras.

## Seven lights

If all seven lights are on, there is one possible digit.

## Six lights

If six lights are on, there are 7 ways you can remove a single light from the "all on" case, so there are 7 digits with six lights.

## Five lights

There are $_7C_5=21$ ways to get digits with 5 lights, but a couple of them (2) are disconnected.

 ---     ---
|   |
---     ---
|   |
---     ---


Therefore, there are 19 digits with 5 lights.

## Four lights

There are $_7C_4=35$ ways to do this. However, with three lights off, there are a few ways you can have a disconnected light. As before, we saw two ways in which there were disconnected lights with five lights. In each of those, we can turn off a light in the "o" section and still be disconnected. This is a total of 8 ways to disconnect. Also, if you turn on the two lights in opposite corners they will be disconnected. There are 2 ways to do this.

Also, you can orphan a vertical piece as follows;

 ---         ---
|   |       |
---    -->
|   |       |   |
---


There are 4 ways to do this.

Lastly, you can have two vertical bars disconnected by turning off all three horizontal lights.

Thus, the total number of ways to have four lights is 35-8-2-4-1=20.

## Three lights

With three lights, you can have a "C" and "U" and "n" and backwards "C", both on the top and on the bottom for a total of 4x2=8. Also, you can have "7" and "L" and their reverse for a total of 4. You can have a left "T" and a right "T" for 2 more. And finally, you can have an "H" missing the top left and bottom right (kind of a zig zag), or its reverse, for a total of 2 more. Grand total is 16.

## Two lights

You can have 4 "L" shaped pieces around every corner on the top and another 4 on the bottom. Also, you can have 2 vertical digits; one on the left and one on the right. Total is 10.

## One light

There are 7 digits with 1 light trivially.

So, the total is:

$$1+7+19+20+16+10+7=80$$

• What about the possibility of four lights being two ones?
– Will
Commented Jul 25, 2016 at 19:16
• @Will Yes, just realized that one and added it. Now I have the same answer as wythagorus, but I don't understand his answer... Commented Jul 25, 2016 at 19:17
• @Will Now I get it! Makes perfect sense. Commented Jul 25, 2016 at 19:18
• This explanation is clearer. Commented Jul 25, 2016 at 19:33

I am going to assume that you need to be able to see the indicator "in the dark". That means that there are several shapes that "look the same" with just an offset difference; and such shapes would not be distinguishable. I do assume you will be able to tell the difference between a "short vertical" and a "long vertical". If that is not the case you will have one fewer "digit".

I can't see a way to avoid enumerating all possibilities:

Of the single-element shapes, there are just two possibilities: horizontal, or vertical.

Of the two-element shapes, there are five possibilities: both vertical (on left or right), and four L shapes.

Of the three-element shapes, there are once again four L's; also there are two T's and four "little" C's, and two "lightning bolts".

Of the four-element shapes, there are four ways to do an F, two ways to do a C, four ways to do an "incomplete P" and four ways to do a "lower case h". There are also four ways to do a "shepherd's crook" and a single "small square".

The five-element "digit" can be in several possible configurations: for three horizontal and two vertical, there are four allowed positions (looking like E, 3, 5 and 2). For two horizontal and three vertical, connectivity is always ensured, meaning there are 3x4=12 possible configurations; and with one horizontal and four vertical, there are 3 configurations.

The six-element digit is always connected: there are 7 of these (any one of the segments could be off) and they are all distinct.

Finally there is the seven digit element.

The total is

2+(1+4)+(4+2+4+2)+(4+2+4+4+4+1)+(4+12+3)+7+1 = 65

Here is a map with all of them - it shows that there are 15 "missing characters" which are actually duplicates (just shifted horizontally, vertically, or both). Add that to my total, and you get the same answer as some of the other posts.

Note - this is lower than other answers because of the "in the dark" element. If that is not included, some of the patterns identified (especially for the lower element counts) can be repeated in multiple locations on the indicator.

• With the display in the photo, all seven segments have unique shapes. Commented Jul 25, 2016 at 22:52
• @supercat - I am assuming that a typical person looking at a display does not tell apart the shapes of the individual segments. I'm thinking about how I look at the alarm clock in my bedroom when I'm not wearing my glasses... Commented Jul 25, 2016 at 22:54
• Some displays ahve all segments the same shape; others have the shapes even more conspicuously varied. I didn't know if you'd noticed the differences in the segment shapes for the display in the picture. Commented Jul 25, 2016 at 22:58
• +1, btw if there is no requirement for direct connection between lines, I think there would be a number of more possibilities. e.g. ☰ or =, etc. Would be easily recognizable. I'm not sure what op means with indirectly connected. Commented Jul 26, 2016 at 12:00
• @akostadinov - I agree with your point. I believe "indirectly connected" means that a horizontal line in the top and bottom segment can be "connected" by lighting up both vertical segments on the same side. Commented Jul 26, 2016 at 13:29

I wrote a python program to check all possibilities and I got:

80 different possibilities
My program messes up with three cases, for some reason, but every other case works. (Thanks for catching the third one, @elias)
Output of program: http://pastebin.com/r2TXH4X8

Actual Program:

• If more than one light is on, all lights are supposed to be connected directly or indirectly. Commented Jul 25, 2016 at 18:01
• @wythagoras What would be an indirect connection? Commented Jul 25, 2016 at 18:02
• I guess a connection through other lights that are on. Commented Jul 25, 2016 at 18:03
• Actually it 'messes up' three cases: 1245, 0246 and 0156 are all invalid cases. So it is 83-3=80 valid cases left. Commented Jul 26, 2016 at 7:17
• If this helps you with correcting your program: in the three messed up cases all lights are connected to another one, but there is two group of two connected lights each, the resulting digit not being connected together. Commented Jul 26, 2016 at 8:54

160

Because of the

Decimal point character... Having it on or off doubles any of the 80 count answers

• The decimal point isn't connected to the other lights. At best you would have one more digit, the decimal point alone. However, the question specifies that the display consists of seven lights, so it is not counting the decimal point as part of the display.
– f''
Commented Jul 26, 2016 at 15:29
• Also, this puzzle indicated there were only 7 lights, the decimal would be an 8th. Commented Jul 26, 2016 at 18:14

128

The easiest way to tackle this problem is to realise there are 7 segments and

each one can be in one of 2 states, so the answer is 27 = 128.

It might help to look at a simpler version of the problem. For example, imagine if we had only a 3-segment display. The first segment could be off/on, and for each of those two settings the second segment could be off/on, which gives 2 × 2 = 4 variants. For these 4 variants, the final segment could be off/on, which gives 8 variants, or 23.

• Hi, welcome to PSE. The question required that the segments that form a digit must be connected to each other. Thus not every combination is possible, for example the "digit" composed of the upper and lower segments is invalid. Commented Dec 8, 2020 at 9:40