The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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.

SEE ALSO

Math::NumSeq, Math::NumSeq::DigitSum, Math::NumSeq::DigitLength, Math::NumSeq::AlphabeticalLength

Tk::SevenSegmentDisplay

HOME PAGE

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

LICENSE

Copyright 2012 Kevin Ryde

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/>.