1Math::NumSeq::KolakoskiU(s3e)r Contributed Perl DocumentaMtaitohn::NumSeq::Kolakoski(3)
2
3
4

NAME

6       Math::NumSeq::Kolakoski -- sequence of 1s and 2s its own run lengths
7

SYNOPSIS

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

DESCRIPTION

14       A sequence 1,2,2,1,1,2,1,etc, each run length being given successively
15       by the sequence itself.
16
17       Starting from 1,2, at i=2 the values is 2, so there should be a run of
18       two 2s.  Then at i=3 value 2 means two 1s.  Then at i=4 value 1 means a
19       run of one 2.  The value alternates between 1 and 2 and the sequence
20       values themselves determine the run length to give that value, either 1
21       or 2.
22

FUNCTIONS

24       See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
25       classes.
26
27       "$seq = Math::NumSeq::Kolakoski->new ()"
28           Create and return a new sequence object.
29

FORMULAS

31       There's no need to keep the entire sequence, nor even the portion
32       between where i is up to and the values past that which those up to i
33       induce.  Instead the value at i is determined by the earlier value,
34       which is determined a yet earlier value, etc.  At each level only a
35       value and pending count need to be kept.  The levels required end up
36       being about log base 1.6 of the position i.
37

SEE ALSO

39       Math::NumSeq, Math::NumSeq::GolombSequence
40

HOME PAGE

42       <http://user42.tuxfamily.org/math-numseq/index.html>
43

LICENSE

45       Copyright 2011, 2012, 2013, 2014, 2016, 2019 Kevin Ryde
46
47       Math-NumSeq is free software; you can redistribute it and/or modify it
48       under the terms of the GNU General Public License as published by the
49       Free Software Foundation; either version 3, or (at your option) any
50       later version.
51
52       Math-NumSeq is distributed in the hope that it will be useful, but
53       WITHOUT ANY WARRANTY; without even the implied warranty of
54       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
55       General Public License for more details.
56
57       You should have received a copy of the GNU General Public License along
58       with Math-NumSeq.  If not, see <http://www.gnu.org/licenses/>.
59
60
61
62perl v5.32.0                      2020-07-28        Math::NumSeq::Kolakoski(3)
Impressum