The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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 occurs in the sequence, which means simply 1, 0 or -1.

SEE ALSO

Math::NumSeq, Math::NumSeq::LiouvilleFunction, Math::NumSeq::PrimeFactorCount

HOME PAGE

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

LICENSE

Copyright 2010, 2011 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/>.