search.cpan.org is shutting down
Kevin Ryde > Math-NumSeq > Math::NumSeq::DivisorCount

Math-NumSeq-72.tar.gz

Dependencies

Annotate this POD

Website

# CPAN RT

 Open 0
View/Report Bugs
Module Version: 72

# NAME

Math::NumSeq::DivisorCount -- how many divisors

# SYNOPSIS

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

# DESCRIPTION

The number of divisors of i,

```    1, 2, 2, 3, 2, 4, 2, 4, 3, 4, 2, 6, 2, 4, 4, 5, 2, 6, 2, ...
starting i=1```

i=1 is divisible only by 1 so value=1. Then i=2 is divisible by 1 and 2 so value=2. Or for example i=6 is divisible by 4 numbers 1,2,3,6 so value=4.

# FUNCTIONS

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

`\$seq = Math::NumSeq::DivisorCount->new ()`

Create and return a new sequence object.

## Random Access

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

Return the number of prime factors in `\$i`.

This calculation requires factorizing `\$i` and in the current code after small factors a hard limit of 2**32 is enforced in the interests of not going into a near-infinite loop.

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

Return true if `\$value` occurs as a divisor count, which simply means `\$value >= 1`.

Math::Factor::XS

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