NAME
Math::NumSeq::HofstadterFigure  sequence excludes its own first differences
SYNOPSIS
use Math::NumSeq::HofstadterFigure;
my $seq = Math::NumSeq::HofstadterFigure>new;
my ($i, $value) = $seq>next;
DESCRIPTION
This is Douglas Hofstadter's "figure" sequence which comprises all integers except those which are differences between its own successive values,
1, 3, 7, 12, 18, 26, 35, 45, 56, 69, 83, 98, ...
So for example at value=1 the next cannot be 2 because the difference 21=1 is already in the sequence, so value=3 with difference 31=2 is next. Then the next cannot be 4 since 43=1 is already in the sequences, and likewise 53=2 and 63=3, so the next is value=7 with 73=4 not already in the sequence.
The effect is that the sequence increments by 1,2,3,4, etc but excluding values of the sequence itself. This makes it close to the Triangular numbers i*(i+1)/2, but incrementing by a little extra at the places it skips its own values.
Start Value
The optional start => $value
can give the first value for the sequence, instead of the default 1. For example starting at 2
2, 3, 7, 12, 18, 26, 35, 45, 56, ...
or starting at 5
5, 6, 8, 11, 15, 22, 31, 41, 53, 66, ...
The differences are still the values not in the sequence, so for example starting at 5 means the differences are 1, 2, 3, 4 before skipping 5 and 6.
In general the effect is to push the first skip up a bit, but still settles down to grow roughly like the triangular numbers.
The start > must be 1 or more. If the start was 0 then the first value and first difference would always be the same, contradicting the conditions for the sequence.
FUNCTIONS
See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.
$seq = Math::NumSeq::HofstadterFigure>new ()
$seq = Math::NumSeq::HofstadterFigure>new (start => $value)

Create and return a new sequence object.
SEE ALSO
Math::NumSeq, Math::NumSeq::Kolakoski
HOME PAGE
http://user42.tuxfamily.org/mathnumseq/index.html
LICENSE
Copyright 2010, 2011, 2012, 2013, 2014, 2016, 2019 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/>.