Math::N...igitSum(3)
π Math::NumSeq::DigitSum β bestie edition π
okay so this is a page from the User Contributed Perl Documentation manual, and it's all about Math::NumSeq::DigitSum, which is literally the sum of the digits of a number, and sometimes the digits get powered too. we love a math glow-up β¨
πΈ NAME πΈ
Math::NumSeq::DigitSum β sum of digits, possibly with powering π
π SYNOPSIS π
use Math::NumSeq::DigitSum;
my $seq = Math::NumSeq::DigitSum->new (radix => 10);
my ($i, $value) = $seq->next;
that's it, that's the whole vibe check π¦
β¨ DESCRIPTION β¨
so basically, for every i, you get the sum of its digits. so the sequence goes 0,1,...,9,1,2,..., etc. and like, at i=123 the value is 1+2+3=6. math ate, no cap π
π«Ά FUNCTIONS π«Ά
peep "FUNCTIONS" in Math::NumSeq for the behaviour that's common to all the sequence classes, because they all share the same group chat.
$seq = Math::NumSeq::DigitSum->new ()$seq = Math::NumSeq::DigitSum->new (radix => $r, power => $p)
make a brand new sequence object and hand it back to you π. the default is decimal, with no powering, or you can pass the radix and/or power parameters if you want to customize the whole situation.
π Random Access π
$value = $seq->ith($i)β returns the sum of the digits of$i, with each digit raised to the givenpowerparameter. yes, raised. it's giving glow-up π$bool = $seq->pred($value)β returns true if$valueever shows up as a sum of digits, which honestly just means"$value >= 0". that's the whole test. iconic behaviour honestly π
π SEE ALSO π
Math::NumSeqMath::NumSeq::DigitLengthMath::NumSeq::DigitProductMath::NumSeq::DigitSumModulo
the whole friend group, obsessed π«Ά
πΈ HOME PAGE πΈ
<http://user42.tuxfamily.org/math-numseq/index.html>
go say hi π
π LICENSE π
Copyright 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.
You should have received a copy of the GNU General Public License along with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
fr fr, that's the legal bit and it's not a joke β no warranty, periodt π
and that's the page bestie!! this one's running on perl v5.42.0, dated 2025-07-25, and the whole thing was brought to you by Math::N...igitSum(3). stay slay, go sum some digits πβ¨π
π¦ 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