NAME
Math::NumSeq::LongFractionPrimes -- primes for which fraction 1/p has a long period
SYNOPSIS
use Math::NumSeq::LongFractionPrimes;
my $seq = Math::NumSeq::LongFractionPrimes->new;
my ($i, $value) = $seq->next;
DESCRIPTION
In progress ...
This is the primes for which fraction 1/p written out in decimal has digits repeating in period p-1.
starting i=1 for prime=2
2, 3, 7, 17, 19, 23, 29, 47, 59, 61, 97, 109, 113, 131, ...
For example 1/7=0.142857142857142857... is runs of 7-1=6 repeating digits "142857", so 7 is in the sequence. On the other hand 1/11=0.09090909... is only 2 repeating digits, so is not in the sequence.
A prime p has full period p-1 digits when the base 10 is a primitive root modulo p, meaning that 10 mod p, 100 mod p, 1000 mod p, ..., 10^(p-2) mod p, are all != 1.
Radix
An optional radix
parameter selects a base other than decimal.
If radix
is a square, 4,9,16,etc then only primes 2 and 3 have period p-1 and the sequence stops after them.
FUNCTIONS
See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.
$seq = Math::NumSeq::LongFractionPrimes->new ()
-
Create and return a new sequence object.
$value = $seq->pred($value)
-
Return true if
$value
is a prime and fraction 1/p has digit period p-1. $i = $seq->i_start ()
-
Return 1, the first term in the sequence being at i=1.
SEE ALSO
Math::NumSeq, Math::NumSeq::Primes
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/>.