NAME
Math::NumSeq::SlopingExcluded -- numbers not occurring in sloping binary
SYNOPSIS
use Math::NumSeq::SlopingExcluded;
my $seq = Math::NumSeq::SlopingExcluded->new;
my ($i, $value) = $seq->next;
DESCRIPTION
In progress ...
The numbers not occurring in sloping binary,
1, 2, 7, 12, 29, 62, 123, 248, 505, 1018, 2047, 4084, 8181, ...
Sloping binary numbers by David Applegate, Benoit Cloitre, Philippe Deléham and Neil Sloane are defined by writing integers in binary and reading on an upwards diagonal slope skipping the high 1 bit.
integers sloping
0 0
1
/
1 0 11 = 3
/
1 1
/ /
1 0 0 110 = 6
/ /
1 0 1 101 = 5
/ /
1 1 0 100 = 4
/
1 1 1
/
1 0 0 0 1111 = 15
It can be shown that the values resulting give all the integers, except one near each power 2^k. The sequence here is those excluded values.
FUNCTIONS
See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.
$seq = Math::NumSeq::SlopingExcluded->new ()
-
Create and return a new sequence object.
$value = $seq->ith($i)
-
Return the
$i
'th value which is not in sloping binary. $bool = $seq->pred($value)
-
Return true if
$value
is not included in sloping binary.
SEE ALSO
HOME PAGE
http://user42.tuxfamily.org/math-numseq/index.html
LICENSE
Copyright 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/>.