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

NAME

Math::NumSeq::GoldbachCount -- number of representations as sum of primes P+Q

SYNOPSIS

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

DESCRIPTION

Not working yet ...

The number of ways each i can be represented as a sum of two primes P+Q.

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

For example i=4 is 2+2 so just 1 way. Or i=10 is 3+7 and 5+5 so 2 ways.

Goldbach's famous conjecture posits that for an even i there's always at least one P+Q=i.

Odd numbers i can only occur as 2+Q, so for them the count is just 1 way if i-2 is prime or 0 ways if not.

FUNCTIONS

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

Create and return a new sequence object.

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

Return the number of ways $i can be represented as a sum of 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::LemoineCount, Math::NumSeq::PrimeFactorCount

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