1Math::NumSeq::Even(3) User Contributed Perl DocumentationMath::NumSeq::Even(3)
2
3
4
6 Math::NumSeq::Even -- even integers
7
9 use Math::NumSeq::Even;
10 my $seq = Math::NumSeq::Even->new;
11 my ($i, $value) = $seq->next;
12
14 The even integers,
15
16 0, 2, 4, 6, 8, 10, ...
17 starting i=0
18
20 See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
21 classes.
22
23 "$seq = Math::NumSeq::Even->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 next()
29 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, or
33 if $value is an even integer then the next higher even.
34
35 Random Access
36 "$value = $seq->ith($i)"
37 Return "2*$i".
38
39 "$bool = $seq->pred($value)"
40 Return true if $value is even.
41
42 "$i = $seq->value_to_i_ceil($value)"
43 "$i = $seq->value_to_i_floor($value)"
44 Return value/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::Odd, Math::NumSeq::All
51
53 <http://user42.tuxfamily.org/math-numseq/index.html>
54
56 Copyright 2010, 2011, 2012, 2013, 2014, 2016, 2019, 2020 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.38.0 2023-07-20 Math::NumSeq::Even(3)