Math::N...mulative(3)

πŸ“¦
version 75 Β· 2 versions
, in fedora 43

πŸ’– 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 numbers 0 to $i, inclusive. don't forget the inclusive part, it matters πŸ’…
  • $bool = $seq->pred($value) β€” returns true if $value actually 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