Math::N...Numbers(3)

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

πŸ’– Math::NumSeq::MoranNumbers πŸ’–

ok so bestie, you found yourself in the Math::N...Numbers(3) page (that's the manual name, yes it's abbreviated like that, don't come for me, perl did it) and honestly? you're about to learn about some iconic little integers. pull up a chair, this is gonna be cute and also extremely precise. ✨


🌸 NAME 🌸

Math::NumSeq::MoranNumbers β€” numbers that get divided by their own digit sum and the answer is a prime. like, main character behavior from a number, fr fr. πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

use Math::NumSeq::MoranNumbers;
my $seq = Math::NumSeq::MoranNumbers->new;
my ($i, $value) = $seq->next;

that's it, that's the whole vibe. three lines and you're iterating. slay. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

the Moran numbers!! here they are, look at them:

18, 21, 27, 42, 45, 63, 84, ...

these are integers that are divisible by the sum of their digits, and when you do that division, the result is a prime. that's the whole personality.

let's take 42 because 42 is always the example, it's the moment:

  • digit sum: 4+2=6
  • divide: 42/6=7
  • and 7? integer βœ… and prime βœ…

so 42 is a Moran number. it's giving math girlboss.

now here's the family tree moment 🌳 β€” this is a subset of the harshad numbers (Math::NumSeq::HarshadNumbers), and harshad numbers are all integers divisible by their digit sum. the extra little ✨restriction✨ here is that the division has to give a prime. so every Moran number is a harshad number, but not every harshad number is a Moran number. iykyk. πŸ’€


πŸ”₯ FUNCTIONS πŸ”₯

okay so, first things first: for the behaviour that every sequence class shares, go read "FUNCTIONS" in Math::NumSeq. that's the shared lore. this page is just the Moran-specific stuff.

  • $seq = Math::NumSeq::MoranNumbers->new ()
  • $seq = Math::NumSeq::MoranNumbers->new (radix => $r) β€” makes you a brand new sequence object and hands it over. 🫢 the radix parameter is optional and it sets the base used for the digits. default is 10, aka decimal, aka what your fingers are doing. the value of $r is up to you and it changes which base the digit-summing happens in.
  • $bool = $seq->pred($value) β€” returns true if $value is a Moran number. and by that i mean: it's divisible by the sum of its digits in the given radix, and that division gives a prime. otherwise you get a false and honestly, respect, not everyone can be a Moran number. 😭

πŸ’œ SEE ALSO πŸ’œ

  • Math::NumSeq
  • Math::NumSeq::DigitSum
  • Math::NumSeq::HarshadNumbers

the whole friend group, go say hi. 🌈


🌟 HOME PAGE 🌟

<http://user42.tuxfamily.org/math-numseq/index.html>


πŸ‘‘ LICENSE πŸ‘‘

Copyright 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. periodt. ✨

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/>.

real talk: that warranty disclaimer is not a vibe, it's a legal fact. no warranty. none. πŸ’€

and that's the page bestie!! πŸŽ€ this lil masterpiece came to you courtesy of perl v5.42.0, dated 2025-07-25, from the User Contributed Perl Documentation collection. go forth and find primes in your digit sums. mwah. πŸ’–πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from