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 ...

This sequence is numbers not occurring when the integers are read by diagonal sloping lines, as per

The sequence begins

1, 2, 7, 12, 29, 62, 123, 248, 505, 1018, 2047, 4084, 8181, ...
starting i=1

All integers are written in binary and the read on an upwards diagonal slope,

 Integers     Sloping     Excluded
 in Binary
 --------     -------     --------
      0         0
      1                      1 = 1
     /                      10 = 2
    1 0        11 = 3
     /
    1 1       101 = 5
   / /
  1 0 0       110 = 6
   / /
  1 0 1       101 = 5
   / /
  1 1 0       100 = 4
   /                       111 = 7
  1 1 1
 /
1 0 0 0      1111 = 15

The authors above show the sloping values give all the integers except one near each power 2^k. The sequence here is those excluded values.

At "1" the sloping value is reckoned as starting from the 1" in the following "10". The effect is that the value "1" which is overlapped this way is excluded. Similarly at "11" the sloping starts from the 1 in "100" and the "10" which is overlapped is excluded.

Radix

Optional radix => $integer parameter selects a base other than binary. For example ternary is

radix => 3
2, 7, 24, 80, 238, 723, 2183, 5653, 19674, 59042, ...

FUNCTIONS

See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.

$seq = Math::NumSeq::SlopingExcluded->new ()
$seq = Math::NumSeq::SlopingExcluded->new (radix => $integer)

Create and return a new sequence object. The default is binary, or another radix can be given.

Random Access

$value = $seq->ith($i)

Return the $i'th value which is sloping excluded.

$bool = $seq->pred($value)

Return true if $value is a sloping excluded.

SEE ALSO

Math::NumSeq

HOME PAGE

http://user42.tuxfamily.org/math-numseq/index.html

LICENSE

Copyright 2012, 2013, 2014, 2016, 2019, 2020 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/>.