NAME
Math::NumSeq::HappyNumbers  reaching 1 under repeated sum of squares of digits
SYNOPSIS
use Math::NumSeq::HappyNumbers;
my $seq = Math::NumSeq::HappyNumbers>new;
my ($i, $value) = $seq>next;
DESCRIPTION
This sequence is the happy numbers which are the numbers eventually reaching 1 on repeatedly taking the sum of the squares of the digits.
1, 7, 10, 13, 19, 23, ...
starting i=1
For example 23 is a happy number because the sum of squares of its digits (ie. 2 and 3) is 2*2+3*3=13, then the same sum of squares again 1*1+3*3=10, then 1*1+0*0=1 reaches 1.
In decimal it can be shown that for a nonzero starting point this procedure always reaches either 1 or the cycle 4,16,37,58,89,145,42,20. The values which reach 1 are called happy numbers.
An optional radix
parameter can select a base other than decimal. Base 2 and base 4 are not very interesting since for them every number except 0 is happy.
FUNCTIONS
See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.
$seq = Math::NumSeq::HappyNumbers>new ()
$seq = Math::NumSeq::HappyNumbers>new (radix => $r)

Create and return a new sequence object.
$bool = $seq>pred($value)

Return true if
$value
is a happy number, meaning repeated sum of squares of its digits reaches 1.
SEE ALSO
Math::NumSeq, Math::NumSeq::HappySteps, Math::NumSeq::DigitSum
HOME PAGE
http://user42.tuxfamily.org/mathnumseq/index.html
LICENSE
Copyright 2011, 2012, 2013, 2014, 2016, 2019, 2020 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/>.