NAME
Math::NumSeq::RadixConversion  radix conversion
SYNOPSIS
use Math::NumSeq::RadixConversion;
my $seq = Math::NumSeq::RadixConversion>new (from_radix => 2,
to_radix => 10);
my ($i, $value) = $seq>next;
DESCRIPTION
This sequence is the index i converted from one radix to another. The default is from binary to decimal,
# starting i=0
0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, ...
For example i=3 in binary is 0b11 which is interpreted as decimal for value 11, ie. eleven.
When from_radix < to_radix
the effect is to give values which in to_radix
use only the digits of from_radix
. The default is all integers which in decimal use only the binary digits, ie. 0 and 1.
When from_radix > to_radix
the conversion is a reduction. The calculation is still a breakdown and reassembly
i = d[k]*from_radix^k + ... + d[1]*from_radix + d[0]
value = d[k]*to_radix^k + ... + d[1]*to_radix + d[0]
but because to_radix
is smaller the value is smaller than the index i. For example from_radix=10 and to_radix=8 turns i=345 into value=3*8^2+4*8+5=229.
FUNCTIONS
See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.
$seq = Math::NumSeq::RadixConversion>new ()
$seq = Math::NumSeq::RadixConversion>new (from_radix => $r, to_radix => $t)

Create and return a new sequence object.
Random Access
$value = $seq>ith($i)

Return
$i
as digits of baseradix
encoded into_radix
. $bool = $seq>pred($value)

Return true if
$value
occurs in the sequence.If
to_radix <= from_radix
then all integer$value
occurs. Ifto_radix > from_radix
then$value
written into_radix
must use only digits 0 tofrom_radix  1
inclusive.
SEE ALSO
Math::NumSeq, Math::NumSeq::DigitSum, Math::NumSeq::HarshadNumbers
HOME PAGE
http://user42.tuxfamily.org/mathnumseq/index.html
LICENSE
Copyright 2012, 2013 Kevin Ryde
MathNumSeq 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.
MathNumSeq 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 MathNumSeq. If not, see <http://www.gnu.org/licenses/>.