1Math::NumSeq::FibonacciUWsoerrd(C3o)ntributed Perl DocumMeanttha:t:iNounmSeq::FibonacciWord(3)
2
3
4
6 Math::NumSeq::FibonacciWord -- 0/1 related to Fibonacci numbers
7
9 use Math::NumSeq::FibonacciWord;
10 my $seq = Math::NumSeq::FibonacciWord->new;
11 my ($i, $value) = $seq->next;
12
14 This is a sequence of 0s and 1s formed from the Fibonacci numbers.
15
16 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, ...
17 starting i=0
18
19 The initial values are 0,1. Then Fibonacci number F(k) many values are
20 copied from the start to extend, repeatedly.
21
22 0,1 initial
23 0,1,0 append 1 value
24 0,1,0,0,1 append 2 values
25 0,1,0,0,1,0,1,0 append 3 values
26 0,1,0,0,1,0,1,0,0,1,0,0,1 append 5 values
27 0,1,0,0,1,0,1,0,0,1,0,0,1,0,1,0,0,1,0,1,0 append 8 values
28 etc
29
30 Morphism
31 The same sequence is had by starting with 0 and then repeatedly
32 expanding
33
34 0 -> 0,1
35 1 -> 0
36
37 Fibbinary and Zeckendorf
38 The result is also the Fibbinary numbers modulo 2, which is the least
39 significant bit of the Zeckendorf base representation of i.
40
41 The Zeckendorf base breakdown subtracts Fibonacci numbers F(k) until
42 reaching 0 or 1. This effectively undoes the above append expansion
43 procedure. (See "Zeckendorf Base" in Math::NumSeq::Fibbinary.)
44
45 start at i
46 until i=0 or i=1 do
47 subtract from i the largest Fibonacci number <= i
48
49 final resulting i=0 or i=1 is Fibonacci word value
50
51 For example i=11 has largest Fibonacci<=11 is 8, subtract that to leave
52 3. From 3 the largest Fibonacci<=3 is 3 itself, subtract that to leave
53 0 which is the Fibonacci word value for i=11.
54
55 Dense Fibonacci Word
56 Option "fibonacci_word_type => "dense"" selects the dense Fibonacci
57 word
58
59 1,0,2,2,1,0,2,2,1,1,0,2,1,1,...
60 starting i=0
61
62 This is the above plain word with each two values (not overlapping)
63 encoded in a binary style as
64
65 plain pair dense value
66 ---------- -----------
67 0,0 0
68 0,1 1
69 1,0 2
70
71 For example the Fibonacci word starts 0,1 so the dense form starts 1.
72 A pair 1,1 never occurs in the plain Fibonacci word so there's no value
73 3 in the dense form.
74
76 See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
77 classes.
78
79 "$seq = Math::NumSeq::FibonacciWord->new ()"
80 "$seq = Math::NumSeq::FibonacciWord->new (fibonacci_word_type => $str)"
81 Create and return a new sequence object. The "fibonacci_word_type"
82 option (a string) can be either
83
84 "plain" (the default)
85 "dense"
86
87 Iterating
88 "$seq->seek_to_i($i)"
89 Move the current i so "next()" will return $i (and corresponding
90 value) on the next call.
91
92 Random Access
93 "$value = $seq->ith($i)"
94 Return the $i'th value in the sequence. The first value is at i=0.
95
96 "$bool = $seq->pred($value)"
97 Return true if $value occurs in the sequence. This simply means 0
98 or 1, or for the dense Fibonacci word 0, 1 or 2.
99
101 Math::NumSeq, Math::NumSeq::Fibonacci, Math::NumSeq::Fibbinary
102
103 Math::PlanePath::FibonacciWordFractal
104
106 <http://user42.tuxfamily.org/math-numseq/index.html>
107
109 Copyright 2011, 2012, 2013, 2014, 2016, 2019 Kevin Ryde
110
111 Math-NumSeq is free software; you can redistribute it and/or modify it
112 under the terms of the GNU General Public License as published by the
113 Free Software Foundation; either version 3, or (at your option) any
114 later version.
115
116 Math-NumSeq is distributed in the hope that it will be useful, but
117 WITHOUT ANY WARRANTY; without even the implied warranty of
118 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
119 General Public License for more details.
120
121 You should have received a copy of the GNU General Public License along
122 with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
123
124
125
126perl v5.32.0 2020-07-28 Math::NumSeq::FibonacciWord(3)