1Math::NumSeq::Odd(3) User Contributed Perl Documentation Math::NumSeq::Odd(3)
2
3
4
6 Math::NumSeq::Odd -- odd integers
7
9 use Math::NumSeq::Odd;
10 my $seq = Math::NumSeq::Odd->new;
11 my ($i, $value) = $seq->next;
12
14 The odd integers
15
16 1, 3, 5, 7, 9, 11, ...
17 starting i=0
18
20 See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
21 classes.
22
23 "$seq = Math::NumSeq::Odd->new ()"
24 Create and return a new sequence object.
25
26 Iterating
27 "$seq->seek_to_i($i)"
28 Move the current sequence position to $i. The next call to
29 "next()" will return $i and corresponding value.
30
31 "$seq->seek_to_value($value)"
32 Move the current i so that "next()" gives $value on the next call,
33 or if $value is an even integer then the next higher even.
34
35 Random Access
36 "$value = $seq->ith($i)"
37 Return "2*$i + 1".
38
39 "$bool = $seq->pred($value)"
40 Return true if $value is odd.
41
42 "$i = $seq->value_to_i_ceil($value)"
43 "$i = $seq->value_to_i_floor($value)"
44 Return (value-1)/2 rounded up or down to the next integer.
45
46 "$i = $seq->value_to_i_estimate($value)"
47 Return an estimate of the i corresponding to $value.
48
50 Math::NumSeq, Math::NumSeq::Even, Math::NumSeq::All
51
53 <http://user42.tuxfamily.org/math-numseq/index.html>
54
56 Copyright 2010, 2011, 2012, 2013, 2014, 2016 Kevin Ryde
57
58 Math-NumSeq is free software; you can redistribute it and/or modify it
59 under the terms of the GNU General Public License as published by the
60 Free Software Foundation; either version 3, or (at your option) any
61 later version.
62
63 Math-NumSeq is distributed in the hope that it will be useful, but
64 WITHOUT ANY WARRANTY; without even the implied warranty of
65 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
66 General Public License for more details.
67
68 You should have received a copy of the GNU General Public License along
69 with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
70
71
72
73perl v5.30.1 2020-01-30 Math::NumSeq::Odd(3)