Math::N...anHypots(3)
π Math::NumSeq::PythagoreanHypots π
okay so bestie, welcome to the manual page for Math::NumSeq::PythagoreanHypots, part of the Math-NumSeq distribution (it's a Perl thing, user contributed docs, iykyk). pull up a chair, we're talking hypotenuses today. π¦
β¨ NAME β¨
Math::NumSeq::PythagoreanHypots β hypotenuses of Pythagorean triples. yes, that's the whole vibe. π
πΈ SYNOPSIS πΈ
use Math::NumSeq::PythagoreanHypots;
my $seq = Math::NumSeq::PythagoreanHypots->new;
my ($i, $value) = $seq->next;
literally three lines and you're in. slay. π
π DESCRIPTION π
so this is all the integers that can show up as the hypotenuse of a Pythagorean triple β meaning the C in A^2+B^2=C^2. that's it, that's the whole concept, and it's iconic:
5, 10, 13, 15, 17, 20, ...
for example, 13 is in there because it pops up as 1^2+12^2 = 13^2. math really said "i'm gonna be cute today." π§
and fr fr, it can be shown that this is all integers which have at least one prime factor of the form 4k+1. no cap.
π Primitive Triples π
setting the option "pythagorean_type => "primitive"" restricts you to just those hypotenuses that occur in primitive triples. quick refresher bestie: for any triple A,B,C, a multiple k*A,k*B,k*C is also a triple. so the primitive triples are the ones where A,B have no common factor which could be divided out. clean. no extra baggage. main character triples only. β¨
5, 13, 17, 25, 29, 37, ...
and it can be shown these are integers comprised only of prime factors 4k+1. (for all triples it's at least one 4k+1 prime factor, and for primitive triples it's all 4k+1 prime factors.) periodt. π
π₯ FUNCTIONS π₯
peep "FUNCTIONS" in Math::NumSeq for the behaviour that's common to all sequence classes, because that's the shared lore.
"$seq = Math::NumSeq::PythagoreanHypots->new ()""$seq = Math::NumSeq::PythagoreanHypots->new (pythagorean_type => $str)"β create and return a new sequence object. give it apythagorean_typestring if you wanna be specific, or don't, live your truth. π«Ά"$bool = $seq->pred($value)"β returns true if$valueoccurs as a hypotenuse in a Pythagorean triple. π―
heads up though: this calculation requires checking the prime factors of$value(to look for either one or all4k+1). in the current code there's a hard limit of2**32placed on$value, in the interests of not going into a near-infinite loop. so like, don't test her. she will simply not. π
π SEE ALSO π
Math::NumSeqMath::NumSeq::CubesMath::PlanePath::PythagoreanTree
go read those too, they're all part of the same friend group. πΈ
π¦ HOME PAGE π¦
<http://user42.tuxfamily.org/math-numseq/index.html>
π LICENSE π
Copyright 2010, 2011, 2012, 2013, 2014, 2016, 2019, 2020 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/>.
and that's the whole page bestie, no crumbs left. this was perl v5.42.0, dated 2025-07-25, and it's the Math::N...anHypots(3) page β yeah the title got a little truncated, she's mysterious like that. π
β¨ go forth and hypotenuse. π
π¦ where this page comes from
- fedora 43: perl-Math-NumSeq 75-11.fc43 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms