NAME
Math::NumSeq::TwinPrimes  twin primes
SYNOPSIS
use Math::NumSeq::TwinPrimes;
my $seq = Math::NumSeq::TwinPrimes>new;
my ($i, $value) = $seq>next;
DESCRIPTION
The twin primes 3, 5, 11, 19, 29, etc, where both P and P+2 are primes.
FUNCTIONS
See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.
$seq = Math::NumSeq::TwinPrimes>new ()
$seq = Math::NumSeq::TwinPrimes>new (pairs => 'second')

Create and return a new sequence object. The optional
pairs
parameter (a string) controls which of each twinprime pair of values is returned"first" the first of each pair, 3,5,11,17 etc "second" the second of each pair 5,7,13,19 etc "both" both values 3,5,7,11,13,17,19 etc "average" the average of the pair, 4,6,12,8 etc
"both" is without repetition, so for example 5 belongs to the pair 3,5 and 5,7, but is returned in the sequence just once.
$bool = $seq>pred($value)

Return true if
$value
is a twin prime of the givenpairs
type. For example with "second"pred()
returns true when$value
is the second of a pair, ie.$value2
is also a prime. $i = $seq>value_to_i_estimate($value)

Return an estimate of the i corresponding to
$value
. Currently this is the asymptotic by Brunvalue i ~= 2 * C *  (log(value))^2
with Hardy and Littlewood's conjectured twinprime constant C=0.66016. In practice it's quite close, being too small by a factor between 0.75 and 0.85 in the small to medium size integers this module might calculate.
SEE ALSO
Math::NumSeq, Math::NumSeq::Primes, Math::NumSeq::SophieGermainPrimes
HOME PAGE
http://user42.tuxfamily.org/mathnumseq/index.html
LICENSE
Copyright 2010, 2011, 2012, 2013, 2014 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/>.