Math::NumSeq::FibonacciWord -- 0/1 related to Fibonacci numbers
use Math::NumSeq::FibonacciWord; my $seq = Math::NumSeq::FibonacciWord->new; my ($i, $value) = $seq->next;
This is a sequence of 0s and 1s formed from the Fibonacci numbers. The start is 0,1 then a Fibonacci number F(k) many values are copied from the start to the end to extend, so
0,1 initial 0,1,0 append 1 value 0,1,0,0,1 append 2 values 0,1,0,0,1,0,1,0 append 3 values 0,1,0,0,1,0,1,0,0,1,0,0,1 append 5 values 0,1,0,0,1,0,1,0,0,1,0,0,1,0,1,0,0,1,0,1,0 append 8 values etc
The same is had by starting 0 and then replacing 0 -> 0,1 and 1 -> 0 to expand.
The result is also the Fibbinary numbers modulo 2. This can be seen most easily from the Zeckendorf base interpretation of those numbers since the base breakdown there works backwards from the above expansion subtracting Fibonacci numbers until reaching 0 or 1. (See "Zeckendorf Base" in Math::NumSeq::Fibbinary.)
$seq = Math::NumSeq::FibonacciWord->new ()
Create and return a new sequence object.
$value = $seq->ith($i)
Return the $i'th value in the sequence. The first value is at i=0.
$i
$bool = $seq->pred($value)
Return true if $value occurs in the sequence, which simply means 0 or 1.
$value
Math::NumSeq, Math::NumSeq::Fibonacci, Math::NumSeq::Fibbinary
Math::PlanePath::FibonacciWordFractal
http://user42.tuxfamily.org/math-numseq/index.html
Copyright 2011, 2012 Kevin Ryde
Math-NumSeq is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Math-NumSeq is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
To install Math::NumSeq, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::NumSeq
CPAN shell
perl -MCPAN -e shell install Math::NumSeq
For more information on module installation, please visit the detailed CPAN module installation guide.