NAME
App::MathImage::NumSeq::CollatzSteps -- steps in the "3n+1" problem
SYNOPSIS
use App::MathImage::NumSeq::CollatzSteps;
my $seq = App::MathImage::NumSeq::CollatzSteps->new;
my ($i, $value) = $seq->next;
DESCRIPTION
The number of steps it takes to reach 1 by the Collatz "3n+1" problem,
n -> / 3n+1 if n odd
\ n/2 if n even
FUNCTIONS
$seq = App::MathImage::NumSeq::CollatzSteps->new (key=>value,...)
-
Create and return a new sequence object.
$value = $seq->ith($i)
-
Return the number of steps to take
$i
down to 1. $bool = $seq->pred($value)
-
Return true if
$value
occurs as a step count. This is true for any non-negative$value
.
SEE ALSO
HOME PAGE
http://user42.tuxfamily.org/math-image/index.html
LICENSE
Copyright 2011 Kevin Ryde
Math-Image 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-Image 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-Image. If not, see <http://www.gnu.org/licenses/>.