Math::N...Product(3)
π Math::NumSeq::DigitProduct π
okay bestie so this is a page from the User Contributed Perl Documentation manual, and it's all about Math::NumSeq::DigitProduct β the product of digits. yes, that's the whole vibe. multiplication, but make it digits. π
β¨ NAME β¨
Math::NumSeq::DigitProduct β product of digits. literally what it says on the tin, no cap.
π¦ SYNOPSIS π¦
use Math::NumSeq::DigitProduct;
my $seq = Math::NumSeq::DigitProduct->new (radix => 10);
my ($i, $value) = $seq->next;
that's it, that's the whole glow-up. you use it, you build it, you call next and it hands you $i and $value like a little gift. π«Ά
πΈ DESCRIPTION πΈ
so the sequence is the products of the digits of i. classic. for example at i=456 the value is 4*5*6=120. math girlies rise π
and i=0? okay so it gets treated as a single digit 0, so its product is 0. not a bug, just the rule. periodt.
now for binary (radix => 2) it's a whole different story β the digits are all just 0 or 1, which means the product is 1 for numbers 0b1, 0b11, 0b111, etc, aka 2**k-1... or 0 otherwise. so it's giving "ones or nothing." iconic behaviour honestly. π₯
π§ FUNCTIONS π§
heads up bestie β see "FUNCTIONS" in Math::NumSeq for the behaviour that's common to all sequence classes. shared lore, iykyk.
"$seq = Math::NumSeq::DigitProduct->new ()""$seq = Math::NumSeq::DigitProduct->new (radix => $r)"β create and return a shiny new sequence object β¨ the default radix is10, ie. decimal, or you can pass aradixparameter if you're feeling spicy.
π Random Access π
"$value = $seq->ith($i)"β return the product of the digits of$i. just... hand it an$i, get the product. simple as."$bool = $seq->pred($value)"β returns true if$valueis the product of some set of digits. meaning: its factors (prime factors, bestie, we're talking prime) are all less than the radix, since nothing bigger can occur. the math is mathing π
π SEE ALSO π
Math::NumSeqMath::NumSeq::DigitLengthMath::NumSeq::DigitSum
the whole friend group. go say hi. π«Ά
π HOME PAGE π
<http://user42.tuxfamily.org/math-numseq/index.html>
π 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/>.
okay so lowkey that warranty part is the serious one β no promises, no guarantees, read the license fr fr. π
aaaand that's the whole page bestie, we ate π
β¨ this one's from perl v5.42.0, dated 2025-07-25, so it's fresh-ish, and it's been a whole journey. mwah, go multiply 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