Math::NumSeq::UlamSequence -- integers uniquely the sum of two previous terms
use Math::NumSeq::UlamSequence; my $seq = Math::NumSeq::UlamSequence->new; my ($i, $value) = $seq->next;
Ulam sequences are integers which are the sum of two previous terms in just one way. The default starting values are 1,2,
1, 2, 3, 4, 6, 8, 11, 13, 16, 18, 26, ...
For example 11 is in the sequence because it's the sum of two previous terms 3+8, and no other such sum. Whereas 12 is not in the sequence because there's two sums 4+8 and 1+11.
See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.
$seq = Math::NumSeq::UlamSequence->new ()
$seq = Math::NumSeq::UlamSequence->new (start_values => '2,5')
Create and return a new sequence object.
Copyright 2010, 2011, 2012, 2013, 2014 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/>.