Kevin Ryde
and 1 contributors

# NAME

Math::NumSeq::SevenSegments -- count of segments to display by 7-segment LED

# SYNOPSIS

`````` use Math::NumSeq::SevenSegments;
my \$seq = Math::NumSeq::SevenSegments->new;
my (\$i, \$value) = \$seq->next;``````

# DESCRIPTION

This is how many segments are lit to display i in 7-segment LEDs

``````    i     = 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 ...
value = 6, 2, 5, 5, 4, 5, 6, 3, 7, 5, 8, 4, 7, 7, 6, 7, 8 ...``````

The segments for each digit are

``````     ---                 ---       ---
|   |         |         |         |     |   |
---       ---       ---
|   |         |     |             |         |
---                 ---       ---

---       ---       ---       ---       ---
|         |             |     |   |     |   |
---       ---                 ---       ---
|     |   |         |     |   |         |
---       ---                 ---           ``````

Options `seven => \$integer` and `nine => \$integer` options give how many segments those digits should be reckoned. Sometimes 7 and 9 have "serif" segments like the following. `seven => 4` and `nine => 6` gives this style

``````     ---        ---
|   |      |   |
---
|          |
--- ``````

Total segments for i is similar to Math::NumSeq::DigitSum, but with digits mapped through a table of segment counts 0->6, 1->2, 2->5, etc.

# FUNCTIONS

See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.

`\$seq = Math::NumSeq::SevenSegments->new ()`
`\$seq = Math::NumSeq::SevenSegments->new (seven => \$int, nine => \$int)`

Create and return a new sequence object.

## Random Access

`\$value = \$seq->ith(\$i)`

Return the number of segments to display `\$i` in 7-segment LEDs.

`\$i = \$seq->i_start ()`

Return 0, the first term in the sequence being at i=0.

Tk::SevenSegmentDisplay

http://user42.tuxfamily.org/math-numseq/index.html

Math-NumSeq-Alpha is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

Math-NumSeq-Alpha is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Math-NumSeq-Alpha. If not, see http://www.gnu.org/licenses/.