Kevin Ryde > Math-NumSeq > Math::NumSeq::MoranNumbers

Math-NumSeq-72.tar.gz

Dependencies

Annotate this POD

Website

# CPAN RT

 Open 0
View/Report Bugs
Module Version: 72

# NAME

Math::NumSeq::MoranNumbers -- numbers divided by sum of digits giving a prime

# SYNOPSIS

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

# DESCRIPTION

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.

# FUNCTIONS

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.

The optional `radix` parameter (default 10, decimal) sets the base to use for the digits.

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

Return true if `\$value` is a Moran number, ie. is divisible by the sum of its digits in the given `radix`, and that division gives a prime.

http://user42.tuxfamily.org/math-numseq/index.html