NAME
Math::NumSeq::GolayRudinShapiro  parity of adjacent 11 bit pairs
SYNOPSIS
use Math::NumSeq::GolayRudinShapiro;
my $seq = Math::NumSeq::GolayRudinShapiro>new;
my ($i, $value) = $seq>next;
DESCRIPTION
This is the Golay/Rudin/Shapiro sequence of +1 or 1 according as an even or odd number of adjacent 11 bit pairs in i.
GRS(i) = (1) ^ (count 11 bit pairs)
starting from i=0
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
The first 1 is at i=3 which is binary 11 with a single 11 bit pair, then i=6 binary 110 likewise 1. Later for example i=14 is binary 1110 which has two adjacent 11 pairs (overlapping pairs count), so value=1.
The value is also the parity of the number of evenlength runs of 1bits in i. An even length run has an odd number of 11 pairs, so each of them is a 1 in the product. An oddlength run of 1bits is an even number of 11 pairs so is +1 and has no effect on the result.
Such a parity of evenlength 1bit runs and hence the GRS sequence arises as the "dX,dY" change for each segment of the alternate paper folding curve. See "dX,dY" in Math::PlanePath::AlternatePaper.
Values Type
Parameter values_type => '0,1'
gives values 0 and 1, being the count of adjacent 11s taken modulo 2, so 0 if even, 1 if odd.
values_type => '0,1'
0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, ...
FUNCTIONS
See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.
$seq = Math::NumSeq::GolayRudinShapiro>new ()
$seq = Math::NumSeq::GolayRudinShapiro>new (values_type => $str)

Create and return a new sequence object. The
values_type
parameter (a string) can be"1,1" 1=even, 1=odd "0,1" 0=even, 1=odd
Random Access
$value = $seq>ith($i)

Return the
$i
'th value from the sequence, being +1 or 1 (or pervalues_type
) according to the number of adjacent 11 bit pairs in$i
. $bool = $seq>pred($value)

Return true if
$value
occurs in the sequence, which simply means$value == 1
or$value == 1
. Or ifvalues_type=>'0,1'
then 0 or 1.
SEE ALSO
Math::NumSeq, Math::NumSeq::GolayRudinShapiroCumulative, Math::NumSeq::BaumSweet, Math::NumSeq::Fibbinary
Math::PlanePath::AlternatePaper
HOME PAGE
http://user42.tuxfamily.org/mathnumseq/index.html
LICENSE
Copyright 2010, 2011, 2012, 2013, 2014, 2016, 2017, 2019, 2020 Kevin Ryde
MathNumSeq 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.
MathNumSeq 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 MathNumSeq. If not, see <http://www.gnu.org/licenses/>.