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

NAME

Math::NumSeq::LemoineCount -- number of representations as P+2*Q for primes P,Q

SYNOPSIS

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

DESCRIPTION

This is a count of how many ways i can be represented as P+2*Q for primes P,Q, starting from i=1.

    0, 0, 0, 0, 0, 1, 1, 1, 2, 0, 2, 1, 2, 0, 2, 1, 4, 0, ...

For example i=6 is 2+2*2, just 1 way. Or i=9 is 3+2*3=9 and 5+2*2=9 so 2 ways.

Lemoine conjectured circa 1894 that all odd i >= 7 can be represented as P+2*Q, ie. a count >=1.

An even i must have P even, ie. P=2 as i=2+2*Q. So for even i the count is is 1 if i/2-1 is a prime or 0 if not.

FUNCTIONS

$seq = Math::NumSeq::LemoineCount->new ()

Create and return a new sequence object.

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

Return the number of ways $i can be represented as P+2*Q for primes P,Q.

This requires checking all primes up to $i and the current code has a hard limit of 2**24 in the interests of not going into a near-infinite loop.

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

Return true if $value occurs as a count. All counts 0 up occur so this is simply integer $value >= 0.

SEE ALSO

Math::NumSeq, Math::NumSeq::Primes, Math::NumSeq::GoldbachCount

HOME PAGE

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

LICENSE

Copyright 2012 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/>.