Math::N...mulative(3)
π Math::N...mulative(3) π
okay bestie, you found a Perl manual page, from the User Contributed Perl Documentation, and it's giving β¨number theoryβ¨. sit down, hydrate, let's get into it π«Ά
πΈ NAME πΈ
Math::NumSeq::DigitLengthCumulative β the total length in digits of the numbers 1 to i π
β¨ SYNOPSIS β¨
use Math::NumSeq::DigitLengthCumulative;
my $seq = Math::NumSeq::DigitLengthCumulative->new (radix => 10);
my ($i, $value) = $seq->next;
that's it. that's the whole vibe. make the object, then next it forever like it's a situationship ππ
π¦ DESCRIPTION π¦
so we're tracking the total length of numbers 0 to i, starting from i=0. lowkey iconic.
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18, 20, 22, 24, 26, ...
"0" counts as a single digit, so at the very start, i=0, the total length is 1. then it's length 1 more for each of i=1 to i=9, and then at i=10 it's length 2 more, etc. yes the numbers grow, no it never stops, main character energy fr fr π₯
default is decimal, but you can pass the optional "radix" parameter to pick another base. for example "radix => 3" ternary, and it goes:
1, 2, 3, 5, 7, 9, 11, 13, 15, 18, 21, 24, 27, 30, ...
math ate, no cap π
π FUNCTIONS π
head over to "FUNCTIONS" in Math::NumSeq for the behaviour that's common to all the sequence classes, bestie. that's the shared lore π
$seq = Math::NumSeq::DigitLengthCumulative->new (radix => $r)β create and return a brand new sequence object. your very own baby π«Ά
π Random Access π
$value = $seq->ith($i)β returns the total length in digits of the numbers0to$i, inclusive. don't forget the inclusive part, it matters π$bool = $seq->pred($value)β returns true if$valueactually shows up in the sequence. vibe check on your number β$i = $seq->value_to_i_floor($value)β returns the index i of$value, or of the next cumulative total below$value. it rounds down, respectfully π§$i = $seq->value_to_i_estimate($value)β returns an estimate of the i that corresponds to$value. it's a guess, it's honest about it, we respect the transparency π
π SEE ALSO π
- Math::NumSeq
- Math::NumSeq::DigitLength
πΈ HOME PAGE πΈ
<http://user42.tuxfamily.org/math-numseq/index.html>
go, click, explore, iykyk πβ¨
π LICENSE π
Copyright 2010, 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. (translation: it's free, it's open, and it comes with zero promises, bestie β that part is serious π)
You should have received a copy of the GNU General Public License along with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
this whole page was brought to you by perl v5.42.0, dated 2025-07-25, filed under Math::N...mulative(3). mwah π thanks for reading, go read a Math::NumSeq page next, ily π«Άπβ¨
π¦ 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