1Math::NumSeq::Pronic(3)User Contributed Perl DocumentatioMnath::NumSeq::Pronic(3)
2
3
4

NAME

6       Math::NumSeq::Pronic -- pronic numbers
7

SYNOPSIS

9        use Math::NumSeq::Pronic;
10        my $seq = Math::NumSeq::Pronic->new;
11        my ($i, $value) = $seq->next;
12

DESCRIPTION

14       The pronic numbers i*(i+1),
15
16           0, 2, 6, 12, 20, 30, ...
17           starting i=0
18
19       These are twice the triangular numbers, and half way between the
20       perfect squares.
21

FUNCTIONS

23       See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
24       classes.
25
26       "$seq = Math::NumSeq::Pronic->new ()"
27           Create and return a new sequence object.
28
29   Iterating
30       "$seq->seek_to_i($i)"
31           Move the current sequence position to $i.  The next call to
32           "next()" will return $i and corresponding value.
33
34       "$seq->seek_to_value($value)"
35           Move the current sequence position so that "next()" will give
36           $value on the next call, or if $value is not a pronic number then
37           the next pronic above $value.
38
39   Random Access
40       "$value = $seq->ith($i)"
41           Return "$i*($i+1)".
42
43       "$bool = $seq->pred($value)"
44           Return true if $value is a pronic number, ie. i*(i+1) for some i.
45
46       "$i = $seq->value_to_i_ceil($value)"
47       "$i = $seq->value_to_i_floor($value)"
48           Return the $i index of $value, rounding up or down if $value is not
49           a pronic number.
50
51       "$i = $seq->value_to_i_estimate($value)"
52           Return an estimate of the i corresponding to $value.  value=i*(i+1)
53           is inverted by
54
55               $i = int( (sqrt(4*$value + 1) - 1)/2 )
56

SEE ALSO

58       Math::NumSeq, Math::NumSeq::Squares, Math::NumSeq::Triangular
59

HOME PAGE

61       <http://user42.tuxfamily.org/math-numseq/index.html>
62

LICENSE

64       Copyright 2010, 2011, 2012, 2013, 2014, 2016, 2017, 2019, 2020 Kevin
65       Ryde
66
67       Math-NumSeq is free software; you can redistribute it and/or modify it
68       under the terms of the GNU General Public License as published by the
69       Free Software Foundation; either version 3, or (at your option) any
70       later version.
71
72       Math-NumSeq is distributed in the hope that it will be useful, but
73       WITHOUT ANY WARRANTY; without even the implied warranty of
74       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
75       General Public License for more details.
76
77       You should have received a copy of the GNU General Public License along
78       with Math-NumSeq.  If not, see <http://www.gnu.org/licenses/>.
79
80
81
82perl v5.36.0                      2022-07-22           Math::NumSeq::Pronic(3)
Impressum