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