NAME

Math::NumSeq::MathImageHypotCount -- how many times as sum of two squares

SYNOPSIS

use Math::NumSeq::MathImageHypotCount;
my $seq = Math::NumSeq::MathImageHypotCount->new;
my ($i, $value) = $seq->next;

DESCRIPTION

In progress ...

The counts of how many times i occurs as the sum of two squares i=A^2+B^2 for integer A,B.

1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, ...

One or both A,B can be zero, but swapping to B^2+A^2 is not reckoned as a different way. For example i=5 has just one way 1^2+2^2=5. But i=6 has no way to add two squares to make 6.

Allowing A=0 means the perfect squares i=k^2 all have a count of at least one way 0^2+k^2 = k^2, and there may be more ways too.

FUNCTIONS

See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.

$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.

This requires factorizing $i and the current code has a hard limit of 2**32 on $i, in the interests of not going into a near-infinite loop.

$bool = $seq->pred($value)

Return true if $value occurs as a count. All counts 0 up occur so this is simply integer $value >= 0.

SEE ALSO

Math::NumSeq, Math::NumSeq::PythagoreanHypots