Kevin Ryde > Math-NumSeq-Alpha-2 > Math::NumSeq::SevenSegments
Module Version: 2

# 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 = 2, 5, 5, 4, 5, 6, 3, 7, 6, 8, 4, 7, 7, 6, 7, 8, 5 ...```

The segments for each digit are

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

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

Sometimes 7 and 9 have "serif" segments

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

The `seven => \$integer` and `nine => \$integer` options give how many segments those digits should be reckoned. Seven can be 3 or 4. Nine can be 5 or 6.

The total 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