Math::N...Numbers(3)
π Math::NumSeq::DuffinianNumbers π
okay bestie, sit down, because we're talking about Math::NumSeq::DuffinianNumbers β a Perl module, a real one, and it's giving no common factor with sum of divisors. yes that's the whole vibe. it's a User Contributed Perl Documentation page, it's manual section 3, and it is lowkey iconic. π
β¨ SYNOPSIS β¨
the three lines you actually need, no notes:
use Math::NumSeq::DuffinianNumbers;
my $seq = Math::NumSeq::DuffinianNumbers->new ();
my ($i, $value) = $seq->next;
literally that's it. you use it, you build it, you pull numbers out one at a time. slay. π
πΈ DESCRIPTION πΈ
so these are the Duffinian numbers, and the definition is: composites that have no common factor with their sum of divisors. that's the whole rule. that's the girl.
the sequence goes:
4, 8, 9, 16, 21, 25, 27, 32, 35, 36, 39, 49, 50, 55, 57, 63, ...
starting i=1
and note the starting i=1 because yes, the indices start at 1, not 0, we're not doing that today.
let's do an example because examples ate:
take 21. its divisors are 1,3,7,21. add them up: that's 32. and 32 has no common factor with 21. boom. Duffinian. β¨
also important: only composites are included. why? because primes would not be particularly interesting for this rule β they'd having only divisors 1,p and so p+1 never having a common factor with p. so like, every prime would trivially qualify and that's boring, we don't want that energy in the sequence. π
π¦ FUNCTIONS π¦
quick heads up before we get into it: see "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes. that's where the shared lore lives, iykyk.
$seq = Math::NumSeq::DuffinianNumbers->new ()β create and return a new sequence object. your very own baby sequence, freshly birthed. π«Ά$bool = $seq->pred($value)β return true if$valueis a Duffinian number.
ok so real talk aboutpred: in the current code a hard limit of2**32is placed on the$valueto be checked, in the interests of not going into a near-infinite loop. and for bigger values the return isundef. so if you feed it something huge, don't come crying, it just hands youundefand walks away. π
π SEE ALSO π
Math::NumSeqβ the mothership, go say hi.
π HOME PAGE π
the house that Kevin built:
<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.
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/>.
ngl that warranty line is the scariest part of any manpage and it's not even close π
that's the whole page bestie, every last detail preserved, no cap. this was perl v5.42.0, dated 2025-07-25 β and yes it's still Math::N...Numbers(3) because the terminal is dramatic and truncates titles like that. 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