Math::PlanePath::MathImagePythagoreanUAD -- primitive pythagorean triples by U,A,D
use Math::PlanePath::MathImagePythagoreanUAD; my $path = Math::PlanePath::MathImagePythagoreanUAD->new; my ($x, $y) = $path->n_to_xy (123);
In progress.
This path is the x,y coordinates of primitive Pythagorean triples taken as a breadth-first traversal of Barning's U/A/D generators.
As a method of visiting all triples near the origin this isn't very practical, since the UAD tree goes out to very distant points while some quite close to the origin remain.
In general at tree depth k, which means visiting N=1 through N=(3^k-1)/2, the smallest x visited is 2*k*(k+1). So going up to say x=364 requires some 800,000 points, the vast majority of which are out at higher x.
$path = Math::PlanePath::MathImagePythagoreanUAD->new ()
Create and return a new path object.
($x,$y) = $path->n_to_xy ($n)
Return the X,Y coordinates of point number $n on the path. Points begin at 0 and if $n < 0 then the return is an empty list.
$n
$n < 0
Fractional positions give an X,Y position along a straight line between the integer positions. Integer positions are always just 1 apart either horizontally or vertically, so the effect is that the fraction part appears either added to or subtracted from X or Y.
Math::PlanePath
http://user42.tuxfamily.org/math-image/index.html
Math-Image is Copyright 2010, 2011 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, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::MathImage
CPAN shell
perl -MCPAN -e shell install App::MathImage
For more information on module installation, please visit the detailed CPAN module installation guide.