1Math::NumSeq::PythagoreUasneHrypCootnst(r3i)buted Perl DMoactuhm:e:nNtuamtSieoqn::PythagoreanHypots(3)
2
3
4
6 Math::NumSeq::PythagoreanHypots -- hypotenuses of Pythagorean triples
7
9 use Math::NumSeq::PythagoreanHypots;
10 my $seq = Math::NumSeq::PythagoreanHypots->new;
11 my ($i, $value) = $seq->next;
12
14 This is integers occurring as the hypotenuse of a Pythagorean triple,
15 ie. the C in A^2+B^2=C^2.
16
17 5, 10, 13, 15, 17, 20, ...
18
19 For example 13 is in the sequence because it occurs as 1^2+12^2 = 13^2.
20
21 It can be shown that this is all integers which have at least one prime
22 factor of the form 4k+1.
23
24 Primitive Triples
25 Option "pythagorean_type => "primitive"" restricts to those hypotenuses
26 occurring in primitive triples. For any triple A,B,C a multiple
27 k*A,k*B,k*C is also a triple. The primitive triples are those where
28 A,B have no common factor which could be divided out.
29
30 5, 13, 17, 25, 29, 37, ...
31
32 It can be shown these are integers comprised only of prime factors
33 4k+1. (For all triples at least one 4k+1 prime factor, and for
34 primitive triples all 4k+1 prime factors.)
35
37 See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
38 classes.
39
40 "$seq = Math::NumSeq::PythagoreanHypots->new ()"
41 "$seq = Math::NumSeq::PythagoreanHypots->new (pythagorean_type =>
42 $str)"
43 Create and return a new sequence object.
44
45 "$bool = $seq->pred($value)"
46 Return true if $value occurs as a hypotenuse in a Pythagorean
47 triple.
48
49 This calculation requires checking the prime factors of $value (to
50 look for either one or all 4k+1). In the current code a hard limit
51 of 2**32 is placed on $value in the interests of not going into a
52 near-infinite loop.
53
55 Math::NumSeq, Math::NumSeq::Cubes
56
57 Math::PlanePath::PythagoreanTree
58
60 <http://user42.tuxfamily.org/math-numseq/index.html>
61
63 Copyright 2010, 2011, 2012, 2013, 2014, 2016, 2019, 2020 Kevin Ryde
64
65 Math-NumSeq is free software; you can redistribute it and/or modify it
66 under the terms of the GNU General Public License as published by the
67 Free Software Foundation; either version 3, or (at your option) any
68 later version.
69
70 Math-NumSeq is distributed in the hope that it will be useful, but
71 WITHOUT ANY WARRANTY; without even the implied warranty of
72 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
73 General Public License for more details.
74
75 You should have received a copy of the GNU General Public License along
76 with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
77
78
79
80perl v5.38.0 2023-07-20Math::NumSeq::PythagoreanHypots(3)