Math::N...nversion(3)
β¨ NAME β¨
Math::NumSeq::RadixConversion β it's giving radix conversion, bestie π
π¦ SYNOPSIS π¦
use Math::NumSeq::RadixConversion;
my $seq = Math::NumSeq::RadixConversion->new (from_radix => 2,
to_radix => 10);
my ($i, $value) = $seq->next;
π DESCRIPTION π
okay so this sequence is literally just the index i, but converted from one radix to another. no cap. the default vibe is from binary to decimal, and it goes like this:
0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, ...
starting i=0
so like, for example, i=3 in binary is 0b11, and that gets interpreted as decimal for value 11, ie. eleven. iconic behavior honestly π
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. that's it, that's the whole set π«Ά
when from_radix > to_radix the conversion is a reduction. the calculation is still a breakdown and re-assembly:
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. math is mathing π₯
πΈ FUNCTIONS πΈ
see "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes. (iykyk)
$seq = Math::NumSeq::RadixConversion->new ()$seq = Math::NumSeq::RadixConversion->new (from_radix => $r, to_radix => $t)β create and return a new sequence object. brand new baby sequence, born just for you π
π§ Random Access π§
$value = $seq->ith($i)β return$ias digits of baseradixencoded into_radix.$bool = $seq->pred($value)β return true if$valueoccurs in the sequence. (does it slay? does it belong? vibe check β )
if to_radix <= from_radix then all integer $value occurs. if to_radix > from_radix then $value written in to_radix must use only digits 0 to from_radix - 1 inclusive. no sneaky extra digits allowed bestie, them's the rules π«
π SEE ALSO π
Math::NumSeq, Math::NumSeq::DigitSum, Math::NumSeq::HarshadNumbers
π HOME PAGE π
<http://user42.tuxfamily.org/math-numseq/index.html>
π LICENSE π
Copyright 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.
ok important, no cap: there's no warranty, like at all, so don't come for anybody if it breaks π
You should have received a copy of the GNU General Public License along with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
and that's the whole page, bestie β brought to you by perl v5.42.0 on 2025-07-25, straight from the Math::N...nversion(3) files πβ¨ periodt.
π¦ where this page comes from
- fedora 43: perl-Math-NumSeq 75-11.fc43 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms