Kevin Ryde > Math-NumSeq-64 > Math::NumSeq::DigitProduct

Math-NumSeq-64.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

 Open 0
View/Report Bugs
Module Version: 64   Source   Latest Release: Math-NumSeq-69

NAME

Math::NumSeq::DigitProduct -- product of digits

SYNOPSIS

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

DESCRIPTION

The products of the digits of i, for example at i=456 the value is 4*5*6=120. i=0 is treated as a single digit 0, so it's product is 0.

For binary (`radix => 2`) the digits are all just 0 or 1 which means the product is 1 for numbers 0b1, 0b11, 0b111, etc, 2**k-1, or 0 otherwise.

FUNCTIONS

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

`\$seq = Math::NumSeq::DigitProduct->new ()`
`\$seq = Math::NumSeq::DigitProduct->new (radix => \$r)`

Create and return a new sequence object. The default radix is 10, ie. decimal, or a `radix` parameter can be given.

Random Access

`\$value = \$seq->ith(\$i)`

Return the product of the digits of `\$i`.

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

Return true if `\$value` is the product of some set of digits. This means its factors (prime factors) are all less than the radix, since nothing bigger can occur.

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