Given a 7-segment display with some segments switched on and some off, find a sequence of digits (0-9), such that after toggling the corresponding segments for each digit, all segments are switched off.
Example
_
_ [3] => | [1] => [OFF]
_ |
Numbers and their corresponding segments:
_ _ _ _ _ _ _ _
| | | _| _| |_| |_ |_ | |_| |_|
|_| | |_ _| | _| |_| | |_| _|
Rules
Codegolf ⊨ shortest entry wins.
Input
A non-empty list of segments which are switched on, given as
A sequence of numbers. Segments are numbered from top to bottom, left to right; starting from 0 or 1. Numbers need not be in order.
A single 7-bit digit. MSB/LSB not specified (thus you can choose).
Non-numeric characters between numbers are allowed (but not required to be supported).
Eg. for number 7
: 136
or 1010010
or 0100101
Output
A sequence of numbers to be "applied" to the display. Not restricted in any way, such as order of the digits. Eg. for initial state corresponding to number 1
, valid outputs would be 1
, 111
, 010
, etc.
An alternative output is a 10-bit digit (again, MSB/LSB is your choice). Eg. for 1
as input, the output would be 1000000000
or 0000000001
.
Some combinations have several non-repetitive solutions, eg. segments corresponding to the uppercase letter H
can be switched off by 013
, but also 489
and 0258
.
If no solution exists (which I believe is not possible), the output is empty.
301
forH
). \$\endgroup\$17
,08
, and1479
. Solutions for the upper vertical segments, left to right, are39
and59
. Solutions for the lower vertical segments, left to right, are56
and2389
. \$\endgroup\$2
isn't always necessary, because you can replace it with either0468
,1358
, or1369
, depending on whether you want a0
,8
or9
in your answer, but there's no way to eliminate7
at all, and I think you have to have at least one of1
and3
. \$\endgroup\$