Math::N...Numbers(3)
π 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. π«Ά theradixparameter is optional and it sets the base used for the digits. default is10, aka decimal, aka what your fingers are doing. the value of$ris up to you and it changes which base the digit-summing happens in.$bool = $seq->pred($value)β returns true if$valueis a Moran number. and by that i mean: it's divisible by the sum of its digits in the givenradix, and that division gives a prime. otherwise you get a false and honestly, respect, not everyone can be a Moran number. π
π SEE ALSO π
Math::NumSeqMath::NumSeq::DigitSumMath::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
- 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