Math::NumSeq::MoranNumbers -- numbers divided by sum of digits giving a prime
use Math::NumSeq::MoranNumbers; my $seq = Math::NumSeq::MoranNumbers->new; my ($i, $value) = $seq->next;
The Moran numbers,
18, 21, 27, 42, 45, 63, 84, ...
being integers which are divisible by the sum of their digits and that division resulting in a prime. For example 42 has digit sum 4+2=6 and 42/6=7 is an integer and a prime.
This is a subset of the harshad numbers (Math::NumSeq::HarshadNumbers), those being all integers divisible by the their digit sum. The further restriction here is that the division gives a prime.
See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.
$seq = Math::NumSeq::MoranNumbers->new ()
$seq = Math::NumSeq::MoranNumbers->new (radix => $r)
Create and return a new sequence object.
radixparameter (default 10, decimal) sets the base to use for the digits.
$bool = $seq->pred($value)
Return true if
$valueis a Moran number, ie. is divisible by the sum of its digits in the given
radix, and that division gives a prime.
Copyright 2012, 2013, 2014, 2016 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/>.