Math::N...lePrimes(3)
π NAME π
Math::NumSeq::DeletablePrimes β bestie, these are the deletable primes, aka primes where you can yeet a digit and still be left with a prime that is also deletable. It's giving recursive slay. π¦
Oh and btw, the manual name is Math::N...lePrimes(3), filed under User Contributed Perl Documentation, iykyk.
β¨ SYNOPSIS β¨
use Math::NumSeq::DeletablePrimes;
my $seq = Math::NumSeq::DeletablePrimes->new;
my ($i, $value) = $seq->next;
That's literally it. Three lines. Main character energy. π
πΈ DESCRIPTION πΈ
Okay so. The deletable primes are primes where you can remove a digit and get another prime β and that prime has to be deletable too. It's primes all the way down, no cap. π
2, 3, 5, 7, 13, 17, 23, 29, 31, 37, 43, ... (A080608)
starting i=0
Take 367 for example β it's a deletable prime because you can delete the 6 and get prime 37, and then from 37 you delete the 3 and get prime 7. Chain complete, gorgeous, iconic. π
And like, there can be more than one chain of deleted digits, which is so extra of it. Same 367? Instead delete the 3 and you get 67, then on to 7. Two paths, both valid, we love a flexible queen.
Since every chain bottoms out at a single-digit prime β that's 2, 3, 5 or 7 β literally every value has at least one such digit in its ancestry. Periodt.
Leading zeros are not allowed, bestie. So the high digit cannot be deleted if it's followed by a zero. Example:2003is not a deletable prime. Deleting the2gives003and that's not allowed (even though it would be a prime, sad), and the other deletes to203or200? Not primes. Sorry girl. π
π’ Radix
Optional parameter radix picks a base other than decimal, for when you're feeling spicy. For binary radix=>2, the primes 2 and 3 β which are two bits, "10" and "11" β get reckoned as endpoints, in the manner of OEIS A096246, since there are no one-bit primes. So they're the floor of the whole thing. π«Ά
π§ FUNCTIONS π§
See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes. The shared lore, if you will.
$seq = Math::NumSeq::DeletablePrimes->new ()$seq = Math::NumSeq::DeletablePrimes->new (radix => $integer)
Create and return a new sequence object. Fresh out of the box, ready to serve. β¨
$bool = $seq->pred($value)
Return true if $value is a deletable prime, in the selected radix. Vibe check: passed or not.
Real talk though β in the current code there's a hard limit of2**32placed on the$valueto be checked, in the interests of not going into a near-infinite loop. So don't come at it with a gigantic number, it will simply not. π
π SEE ALSO π
- Math::NumSeq
- Math::NumSeq::Primes
- Math::NumSeq::SophieGermainPrimes
Go read those too, they're all part of the same friend group. π
This whole page came to you courtesy of perl v5.42.0, dated 2025-07-25, under the name Math::N...lePrimes(3). Bye bestie, go delete some digits responsibly! ππΈπ
π¦ where this page comes from
- fedora 43: perl-Math-NumSeq 75-11.fc43 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms