Math::N...anHypots(3)

πŸ“¦
version 75 Β· 2 versions
, in fedora 43

πŸ’– 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 a pythagorean_type string if you wanna be specific, or don't, live your truth. 🫢
  • "$bool = $seq->pred($value)" β€” returns true if $value occurs 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 all 4k+1). in the current code there's a hard limit of 2**32 placed 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::NumSeq
  • Math::NumSeq::Cubes
  • Math::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