1Math::NumSeq::WoodallNuUmsbeerrsC(o3n)tributed Perl DocuMmaetnht:a:tNiuomnSeq::WoodallNumbers(3)
2
3
4
6 Math::NumSeq::WoodallNumbers -- Woodall numbers i*2^i-1
7
9 use Math::NumSeq::WoodallNumbers;
10 my $seq = Math::NumSeq::WoodallNumbers->new;
11 my ($i, $value) = $seq->next;
12
14 The Woodall numbers i*2^i-1 starting from i=1,
15
16 1, 7, 23, 63, 159, 383, 895, 2047, 4607, 10239, ...
17
19 See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
20 classes.
21
22 "$seq = Math::NumSeq::WoodallNumbers->new ()"
23 Create and return a new sequence object.
24
25 Iterating
26 "$seq->seek_to_i($i)"
27 Move the current sequence position to $i. The next call to
28 "next()" will return $i and corresponding value.
29
30 Random Access
31 "$value = $seq->ith($i)"
32 Return "$i * 2**$i - 1".
33
34 "$bool = $seq->pred($value)"
35 Return true if $value is a Woodall number, ie. is equal to i*2^i-1
36 for some i.
37
38 "$i = $seq->value_to_i_floor($value)"
39 Return the index i of $value or of the next Woodall number below
40 $value.
41
42 "$i = $seq->value_to_i_estimate($value)"
43 Return an estimate of the i corresponding to $value.
44
46 Value to i Estimate
47 An easy over-estimate is l=log2(value), which reverses value=2^l. It
48 can be reduced by the bit length of that l as i=l-log2(l) to get
49 closer.
50
52 Math::NumSeq, Math::NumSeq::CullenNumbers, Math::NumSeq::ProthNumbers
53
55 <http://user42.tuxfamily.org/math-numseq/index.html>
56
58 Copyright 2011, 2012, 2013, 2014, 2016, 2019 Kevin Ryde
59
60 Math-NumSeq is free software; you can redistribute it and/or modify it
61 under the terms of the GNU General Public License as published by the
62 Free Software Foundation; either version 3, or (at your option) any
63 later version.
64
65 Math-NumSeq is distributed in the hope that it will be useful, but
66 WITHOUT ANY WARRANTY; without even the implied warranty of
67 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
68 General Public License for more details.
69
70 You should have received a copy of the GNU General Public License along
71 with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
72
73
74
75perl v5.32.0 2020-07-28 Math::NumSeq::WoodallNumbers(3)