NAME
Math::NumSeq::LiouvilleFunction  Liouville function sequence
SYNOPSIS
use Math::NumSeq::LiouvilleFunction;
my $seq = Math::NumSeq::LiouvilleFunction>new;
my ($i, $value) = $seq>next;
DESCRIPTION
The Liouville function parity of the prime factors of i,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
starting i=1
being
1 if i has an even number of prime factors
1 if i has an odd number of prime factors
The sequence starts from i=1 which is taken to be no prime factors, ie. zero, which is even, hence value 1. Then i=2 and i=3 are 1 since they have one prime factor (they're primes), and i=4 is value 1 because it's 2*2 which is an even number of prime factors (two 2s).
This parity is similar to the MobiusFunction
, but here repeated prime factors are included, whereas in MobiusFunction
they give a value 0.
Values Type
The values_type
parameter can change the two values returned for even or odd prime factors. "0,1" gives 0 for even and 1 for odd, the same as the count mod 2,
values_type => '0,1'
0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, ...
Or "1,0" the other way around, 1 for even, 0 for odd,
values_type => '1,0'
1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, ...
FUNCTIONS
See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.
$seq = Math::NumSeq::LiouvilleFunction>new ()
$seq = Math::NumSeq::LiouvilleFunction>new (values_type => $str)

Create and return a new sequence object. Optional
values_type
(a string) can be"1,1" 1=even, 1=odd (the default) "0,1" 0=even, 1=odd "1,0" 1=even, 0=odd
Random Access
$value = $seq>ith($i)

Return the Liouville function of
$i
, being 1 or 1 (or othervalues_type
) according to 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 nearinfinite loop. $bool = $seq>pred($value)

Return true if
$value
occurs in the sequence, which simply means 1 or 1, or the twovalues_type
values.
SEE ALSO
Math::NumSeq, Math::NumSeq::MobiusFunction, Math::NumSeq::PrimeFactorCount
HOME PAGE
http://user42.tuxfamily.org/mathnumseq/index.html
LICENSE
Copyright 2011, 2012, 2013, 2014, 2016, 2019 Kevin Ryde
MathNumSeq 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.
MathNumSeq 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 MathNumSeq. If not, see <http://www.gnu.org/licenses/>.