NAME
Math::NumSeq::DeletablePrimes -- primes on deleting a digit repeatedly
SYNOPSIS
use Math::NumSeq::DeletablePrimes;
my $seq = Math::NumSeq::DeletablePrimes->new;
my ($i, $value) = $seq->next;
DESCRIPTION
The deletable primes, being primes which can have a digit removed to give another prime which in turn is deletable.
2, 3, 5, 7, 13, 17, 23, 29, 31, 37, 43, ... (A080608)
starting i=0
For example 367 is a deletable prime because it's possible to delete the 6 giving prime 37 then from that delete the 3 giving prime 7.
There can be more than one chain of deleted digits, as for example 367 instead delete 3 to 67 then to 7. Since the chain ends with single digit prime 2, 3, 5 or 7, all values have at least one such digit.
Leading zeros are not allowed, so the high digit cannot be deleted if it's followed by a zero. For example 2003 is not a deletable prime. Deleting the 2 to give 003 is not allowed (though it would be a prime), and other deletes to 203 or 200 are not primes.
Radix
Optional parameter radix
selects a base other than decimal. For binary radix=>2
, primes 2 and 3 which are two bits "10" and "11" are reckoned as endpoints in the manner of OEIS A096246, since there are no one-bit primes.
FUNCTIONS
See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.
$seq = Math::NumSeq::DeletablePrimes->new ()
$seq = Math::NumSeq::DeletablePrimes->new (radix => $integer)
-
Create and return a new sequence object.
$bool = $seq->pred($value)
-
Return true if
$value
is a deletable prime, in the selected radix.In the current code a hard limit of 2**32 is placed on the
$value
to be checked, in the interests of not going into a near-infinite loop.
SEE ALSO
Math::NumSeq, Math::NumSeq::Primes, Math::NumSeq::SophieGermainPrimes