Math::NumSeq::LuckyNumbers -- sieved out multiples by the sequence itself
use Math::NumSeq::LuckyNumbers; my $seq = Math::NumSeq::LuckyNumbers->new; my ($i, $value) = $seq->next;
This is the so-called "Lucky" numbers obtained by sieving out multiples taken from the sequence itself
starting i=1 1, 3, 7, 9, 13, 15, 21, 25, 31, 33, 37, 43, 49, 51, 63, 67, ...
The sieve begins with the odd numbers
1,3,5,7,9,11,13,15,17,19,21,23,25,...
Then sieve[2]=3 from the sequence means remove every third number, counting from the start, so remove 5,11,17, etc to leave
1,3,7,9,13,15,19,21,25,...
Then the next value sieve[3]=7 means remove every seventh number, so 19 etc, to leave
1,3,7,9,13,15,21,25,...
Then sieve[4]=9 means remove every ninth from what remains, and so on. In each case the removals count from the start of the values which remain at that stage.
It can be shown the values grow at roughly the same rate as the primes, i =~ value/log(value).
See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.
$seq = Math::NumSeq::LuckyNumbers->new ()
Create and return a new sequence object.
$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,
$value
i ~= value/log(value)
So value_to_i_estimate() returns $value/log($value).
value_to_i_estimate()
$value/log($value)
Math::NumSeq, Math::NumSeq::ReRound, Math::NumSeq::ReReplace
http://user42.tuxfamily.org/math-numseq/index.html
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/>.
To install Math::NumSeq, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::NumSeq
CPAN shell
perl -MCPAN -e shell install Math::NumSeq
For more information on module installation, please visit the detailed CPAN module installation guide.