Math::NumSeq::DeletablePrimes -- primes deleting a digit repeatedly
use Math::NumSeq::DeletablePrimes; my $seq = Math::NumSeq::DeletablePrimes->new; my ($i, $value) = $seq->next;
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, ... 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.
The optional radix
parameter selects a base other than decimal. In binary radix=>2
primes 2 and 3 which are 10 and 11 are reckoned as endpoints, since there are no single-digit primes.
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.
Math::NumSeq, Math::NumSeq::Primes, Math::NumSeq::SophieGermainPrimes