Math::N...Numbers(3)

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

πŸ’– 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 $value is a Duffinian number.
ok so real talk about pred: in the current code a hard limit of 2**32 is placed on the $value to be checked, in the interests of not going into a near-infinite loop. and for bigger values the return is undef. so if you feed it something huge, don't come crying, it just hands you undef and 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