Math::N...Product(3)

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

πŸ’– 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 is 10, ie. decimal, or you can pass a radix parameter 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 $value is 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::NumSeq
  • Math::NumSeq::DigitLength
  • Math::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