NAME
Math::NumSeq::MathImageRadixConversion -- radix conversion
SYNOPSIS
use Math::NumSeq::MathImageRadixConversion;
my $seq = Math::NumSeq::MathImageRadixConversion->new (radix => 2,
to_radix => 10);
my ($i, $value) = $seq->next;
DESCRIPTION
This is integers converted from one radix to another. The default is binary converted to decimal,
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.
The radix parameter is the from radix, and to_radix what it's converted to.
When radix < to_radix the effect is to give all integers which in to_radix use only the digits of radix. So the default is all integers which in decimal use only the binary digits, ie. 0 and 1.
When radix > to_radix the conversion is a reduction. The calculation is still a breakdown and re-assembly
dk*radix^k + d2*radix^2 + ... + d1*radix + d0 = i
value = dk*to_radix^k + d2*to_radix^2 + ... + d1*to_radix + d0
but with to_radix being smaller it's a reduction. For example radix=10 i=123 with to_radix=8 gives 1*8^2+2*8+3=83.
FUNCTIONS
See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.
$seq = Math::NumSeq::MathImageRadixConversion->new ()$seq = Math::NumSeq::MathImageRadixConversion->new (radix => $r, to_radix => $t)-
Create and return a new sequence object.
$value = $seq->ith($i)-
Return
$ias digits of baseradixencoded into_radix. $bool = $seq->pred($value)-
Return true if
$valueoccurs in the sequence ...
SEE ALSO
Math::NumSeq, Math::NumSeq::DigitSum, Math::NumSeq::HarshadNumbers