1Math::NumSeq::GolombSeqUuseenrceC(o3n)tributed Perl DocuMmaetnht:a:tNiuomnSeq::GolombSequence(3)
2
3
4

NAME

6       Math::NumSeq::GolombSequence -- sequence is its own run lengths, 1
7       upwards
8

SYNOPSIS

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

DESCRIPTION

15       A sequence of integers with each run length being given by the sequence
16       itself.
17
18           1, 2,2, 3,3, 4,4,4, 5,5,5, 6,6,6,6,...
19
20       Starting from 1,2, at i=2 the value is 2, so there should be a run of
21       two 2s.  Then at i=3 value 2 means two 3s.  Then at i=4 value 3 means a
22       run of three 4s, and so on.
23
24           Values     Run Length (is the sequence itself)
25           1,            1
26           2,2,          2
27           3,3,          2
28           4,4,4,        3
29           5,5,5,        3
30           6,6,6,6,      4
31           ...          ...
32
33   Using Values
34       The default is to use all integers successively for the values.  The
35       "using_values" option can choose a different set of values.  In each
36       case those values from the sequence are the run lengths.
37
38       "using_values => 'odd'" uses only odd numbers,
39
40           1, 3,3,3, 5,5,5, 7,7,7, 9,9,9,9,9, ...
41
42       "using_values => 'even'" uses only even numbers,
43
44           2,2, 4,4, 6,6,6,6, 8,8,8,8, ...
45
46       "using_values => '3k'" uses only triples,
47
48           3,3,3, 6,6,6, 9,9,9, 12,12,12,12,12,12, ...
49
50       "using_values => 'squares'" uses the squares,
51
52           1, 4,4,4,4, 9,9,9,9, 16,16,16,16, 25,25,25,25, ...
53
54       "using_values => 'primes'" uses the primes,
55
56           2,2, 3,3, 5,5,5, 7,7,7, 11,11,11,11,11, ...
57

FUNCTIONS

59       See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
60       classes.
61
62       "$seq = Math::NumSeq::GolombSequence->new ()"
63       "$seq = Math::NumSeq::GolombSequence->new (using_values => $str)"
64           Create and return a new sequence object.  The "using_values" option
65           as described above can be
66
67               "all"
68               "odd"
69               "even"
70               "3k"
71               "squares"
72               "primes"
73

SEE ALSO

75       Math::NumSeq, Math::NumSeq::Kolakoski
76
77       Math::NumSeq::Odd, Math::NumSeq::Even, Math::NumSeq::Squares,
78       Math::NumSeq::Primes
79

HOME PAGE

81       <http://user42.tuxfamily.org/math-numseq/index.html>
82

LICENSE

84       Copyright 2011, 2012, 2013, 2014, 2016, 2019, 2020 Kevin Ryde
85
86       Math-NumSeq is free software; you can redistribute it and/or modify it
87       under the terms of the GNU General Public License as published by the
88       Free Software Foundation; either version 3, or (at your option) any
89       later version.
90
91       Math-NumSeq is distributed in the hope that it will be useful, but
92       WITHOUT ANY WARRANTY; without even the implied warranty of
93       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
94       General Public License for more details.
95
96       You should have received a copy of the GNU General Public License along
97       with Math-NumSeq.  If not, see <http://www.gnu.org/licenses/>.
98
99
100
101perl v5.36.0                      2023-01-20   Math::NumSeq::GolombSequence(3)
Impressum