++ed by:

2 PAUSE users

Kevin Ryde


Math::NumSeq::DuffinianNumbers -- no common factor with sum of divisors


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


This is the Duffinian numbers which are composites having no common factor with their sum of divisors.

    4, 8, 9, 16, 21, 25, 27, 32, 35, 36, 39, 49, 50, 55, 57, 63, ...
    starting i=1

For example 21 has divisors 1,3,7,21 total 32 which has no common factor with 21. Only composites are included since 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.


See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.

$seq = Math::NumSeq::DuffinianNumbers->new ()

Create and return a new sequence object.

$bool = $seq->pred($value)

Return true if $value is a Duffinian number.

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. The return is undef for bigger values.






Copyright 2012, 2013, 2014 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/>.