Math::NumSeq::MathImageHypotCount -- how many times as a Pythagorean hypotenuse
use Math::NumSeq::MathImageHypotCount; my $seq = Math::NumSeq::MathImageHypotCount->new; my ($i, $value) = $seq->next;
The counts of how many times each integer occurs as the hypotenuse of a Pythagorean triangle, being the number of ways an integer can be expressed as the sum of two squares a^2+b^2. For example at i=25 the values is 2 since 25 can be expressed two ways, 3^3+4^4 and 0^2+5^2.
Because 0^2+k^2 == k^2 is counted, the perfect squares always have a count at least 1, but it may be more.
$seq = Math::NumSeq::MathImageHypotCount->new ()
Create and return a new sequence object.
$value = $seq->ith($i)
Return the number of ways $i can be expressed as the sum of two squares.
$i
$bool = $seq->pred($value)
Return true if $value occurs as a count. All counts 0 up occur so this is simply integer $value >= 0.
$value
$value >= 0
Math::NumSeq
http://user42.tuxfamily.org/math-image/index.html
Copyright 2011, 2012 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/>.
To install App::MathImage::Image::Base::Caca, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::MathImage::Image::Base::Caca
CPAN shell
perl -MCPAN -e shell install App::MathImage::Image::Base::Caca
For more information on module installation, please visit the detailed CPAN module installation guide.