and 1 contributors

# NAME

Math::NumSeq::MobiusFunction -- Mobius function sequence

# SYNOPSIS

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

# DESCRIPTION

The sequence of the Mobius function, 1, -1, -1, 0, -1, 1, etc,

``````    1   if i has an even number of distinct prime factors
-1  if i has an odd number of distinct prime factors
0   if i has a repeated prime factor``````

The sequence starts from i=1 and it's reckoned as no prime factors, ie. 0 factors, which is considered even, hence Mobius function 1. Then i=2 and i=3 are value -1 since they have one prime factor (they're primes), and i=4 is value 0 because it's 2*2 which is a repeated prime 2.

# FUNCTIONS

`\$seq = Math::NumSeq::MobiusFunction->new (key=>value,...)`

Create and return a new sequence object.

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

Return the Mobius function of `\$i`, being 1, 0 or -1 according to the prime factors of `\$i`.

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

Return true if `\$value` is 1, 0 or -1.