NAME

Math::NumSeq::DigitExtract -- one of the digits of integers 0 upwards

SYNOPSIS

use Math::NumSeq::DigitExtract;
my $seq = Math::NumSeq::DigitExtract->new (extract_type => 'median');
my ($i, $value) = $seq->next;

DESCRIPTION

In progress ...

Extract one of the digits from the index i. The default is to extract the lowest decimal digit,

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, ...
starting i=0

The extract_type option (a string) gives which digit to extract

"low"               least significant digit
"high"              most significant digit
"middle_lower"      second least significant digit
"middle_higher"     second most significant digit
"minimum"           smallest digit
"maximum"           largest digit

For an even number of digits "middle_lower" selects the lower position one and "middle_higher" selects the higher position one.

Option radix => $integer selects a base other than decimal.

Offset

Option extract_offset => $integer can select the digit at a position offset from the extract_type. For example with the default "low" an offset of 1 gives the second lowest digit,

extract_offset=>1
0,0,0,0,0,0,0,0,0,0, 1,1,1,1,1,1,1,1,1,1, 2,2,2,2,2,2,2,2,2,2,

For "minimum" and "maximum" the digits are imagined sorted into increasing or decreasing order then the extract_offset applied to select from there.

FUNCTIONS

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

$seq = Math::NumSeq::DigitExtract->new (extract_type => $integer, extract_offset => $integer, radix => $integer)

Create and return a new sequence object.

Random Access

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

Return the $i'th value from the sequence.

SEE ALSO

Math::NumSeq, Math::NumSeq::DigitCount, Math::NumSeq::DigitLength

HOME PAGE

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

LICENSE

Copyright 2011, 2012, 2013, 2014, 2016, 2019, 2020 Kevin Ryde

Math-NumSeq 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 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. If not, see <http://www.gnu.org/licenses/>.