Math::N...Numbers(3)
π Math::NumSeq::LuckyNumbers β the manual, but make it cute π
okay so bestie, this is the Math::NumSeq::LuckyNumbers page from the User Contributed Perl Documentation, and it's literally about numbers that are lucky enough to survive a sieve that they run on themselves. main character energy fr. πβ¨
πΈ NAME πΈ
Math::NumSeq::LuckyNumbers β sieved out multiples by the sequence itself. no cap, the sequence does the sieving. iconic behavior. π
π SYNOPSIS π
use Math::NumSeq::LuckyNumbers;
my $seq = Math::NumSeq::LuckyNumbers->new;
my ($i, $value) = $seq->next;
that's it. that's the whole vibe. go get your numbers bestie π«Ά
π¦ DESCRIPTION π¦
These are the so-called "Lucky" numbers, and the way you get them is by sieving out multiples that are taken from the sequence itself. self-referential queen behavior.
starting i=1:
1, 3, 7, 9, 13, 15, 21, 25, 31, 33, 37, 43, 49, 51, 63, 67, ...
so here's the lore. the sieve begins with the odd numbers:
1,3,5,7,9,11,13,15,17,19,21,23,25,...
then sieve[2]=3 β that 3 comes from the sequence itself β means remove every third number, counting from the start. so bye bye 5, 11, 17, etc. π and what's left is:
1,3,7,9,13,15,19,21,25,...
then the next value sieve[3]=7 says remove every seventh number, so 19 etc gets evicted, and we're left with:
1,3,7,9,13,15,21,25,...
then sieve[4]=9 means remove every ninth from whatever remains, and so on forever, bestie. in each case the removals count from the start of the values which remain at that stage. so it's always the current surviving lineup, not the original one. noted. π
and it can be shown that the values grow at roughly the same rate as the primes, i =~ value/log(value). slay. π₯
β¨ FUNCTIONS β¨
see "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes. the shared lore, iykyk.
$seq = Math::NumSeq::LuckyNumbers->new ()β create and return a new sequence object. boom, you have a sequence now. π$i = $seq->value_to_i_estimate($value)β return an estimate of the i corresponding to$value. it can be shown that values grow roughly at the same rate as the primes:
i ~= value/log(value)
so value_to_i_estimate() returns "$value/log($value)". that's it. that's the estimate. accurate-ish and unbothered. β
π SEE ALSO π
Math::NumSeqMath::NumSeq::ReRoundMath::NumSeq::ReReplace
go read those too, they're the friend group. π«Ά
π HOME PAGE π
<http://user42.tuxfamily.org/math-numseq/index.html>
π LICENSE π
Copyright 2012, 2013, 2014, 2016, 2019, 2020 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/>.
β οΈ okay real talk for a sec: that warranty disclaimer is not a joke, it's literally saying there's NO WARRANTY, so don't come for anyone if it misbehaves. read the license, bestie. π
and that's the whole page!! π
this was Math::N...Numbers(3) from perl v5.42.0, dated 2025-07-25. ty for coming to my ted talk, mwah, go sieve some numbers πβ¨π¦πΈ
π¦ 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