.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Math::PlanePath::AnvilSpiral 3pm" .TH Math::PlanePath::AnvilSpiral 3pm "2021-01-23" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Math::PlanePath::AnvilSpiral \-\- integer points around an "anvil" shape .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use Math::PlanePath::AnvilSpiral; \& my $path = Math::PlanePath::AnvilSpiral\->new; \& my ($x, $y) = $path\->n_to_xy (123); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This path makes a spiral around an anvil style shape, .PP .Vb 10 \& ...\-78\-77\-76\-75\-74 4 \& / \& 49\-48\-47\-46\-45\-44\-43\-42\-41\-40\-39\-38 73 3 \& \e / / \& 50 21\-20\-19\-18\-17\-16\-15\-14 37 72 2 \& \e \e / / / \& 51 22 5\-\-4\-\-3\-\-2 13 36 71 1 \& \e \e \e / / / / \& 52 23 6 1 12 35 70 <\- Y=0 \& / / / \e \e \e \& 53 24 7\-\-8\-\-9\-10\-11 34 69 \-1 \& / / \e \e \& 54 25\-26\-27\-28\-29\-30\-31\-32\-33 68 \-2 \& / \e \& 55\-56\-57\-58\-59\-60\-61\-62\-63\-64\-65\-66\-67 \-3 \& \& ^ \& \-6 \-5 \-4 \-3 \-2 \-1 X=0 1 2 3 4 5 6 7 .Ve .PP The pentagonal numbers 1,5,12,22,etc, P(k) = (3k\-1)*k/2 fall alternately on the X axis X>0, and on the Y=1 horizontal X<0. .PP Those pentagonals are always composites, from the factorization shown, and as noted in \*(L"Step 3 Pentagonals\*(R" in Math::PlanePath::PyramidRows, the immediately preceding P(k)\-1 and P(k)\-2 are also composites. So plotting the primes on the spiral has a 3\-high horizontal blank line at Y=0,\-1,\-2 for positive X, and Y=1,2,3 for negative X (after the first few values). .PP Each loop around the spiral is 12 longer than the preceding. This is 4* more than the step=3 \f(CW\*(C`PyramidRows\*(C'\fR so straight lines on a \f(CW\*(C`PyramidRows\*(C'\fR like these pentagonals are also straight lines here, but split into two parts. .PP The outward diagonal excursions are similar to the \f(CW\*(C`OctagramSpiral\*(C'\fR, but there's just 4 of them here where the \f(CW\*(C`OctagramSpiral\*(C'\fR has 8. This is reflected in the loop step. The basic \f(CW\*(C`SquareSpiral\*(C'\fR is step 8, but by taking 4 excursions here increases that to 12, and in the \f(CW\*(C`OctagramSpiral\*(C'\fR 8 excursions adds 8 to make step 16. .SS "Wider" .IX Subsection "Wider" An optional \f(CW\*(C`wider\*(C'\fR parameter makes the path wider by starting with a horizontal section of given width. For example .PP .Vb 1 \& $path = Math::PlanePath::SquareSpiral\->new (wider => 3); .Ve .PP gives .PP .Vb 9 \& 33\-32\-31\-30\-29\-28\-27\-26\-25\-24\-23 ... 2 \& \e / / \& 34 11\-10\-\-9\-\-8\-\-7\-\-6\-\-5 22 51 1 \& \e \e / / / \& 35 12 1\-\-2\-\-3\-\-4 21 50 <\- Y=0 \& / / \e \e \& 36 13\-14\-15\-16\-17\-18\-19\-20 49 \-1 \& / \e \& 37\-38\-39\-40\-41\-42\-43\-44\-45\-46\-47\-48 \-2 \& \& ^ \& \-6 \-5 \-4 \-3 \-2 \-1 X=0 1 2 3 4 5 .Ve .PP The starting point 1 is shifted to the left by ceil(wider/2) places to keep the spiral centred on the origin X=0,Y=0. This is the same starting offset as the \f(CW\*(C`SquareSpiral\*(C'\fR \f(CW\*(C`wider\*(C'\fR. .PP Widening doesn't change the nature of the straight lines which arise, it just rotates them around. Each loop is still 12 longer than the previous, since the widening is essentially a constant amount in each loop. .SS "N Start" .IX Subsection "N Start" The default is to number points starting N=1 as shown above. An optional \&\f(CW\*(C`n_start\*(C'\fR can give a different start with the same shape. For example to start at 0, .PP .Vb 1 \& n_start => 0 \& \& 20\-19\-18\-17\-16\-15\-14\-13 ... \& \e / / \& 21 4\-\-3\-\-2\-\-1 12 35 \& \e \e / / / \& 22 5 0 11 34 \& / / \e \e \& 23 6\-\-7\-\-8\-\-9\-10 33 \& / \e \& 24\-25\-26\-27\-28\-29\-30\-31\-32 .Ve .PP The only effect is to push the N values around by a constant amount. It might help match coordinates with something else zero-based. .SH "FUNCTIONS" .IX Header "FUNCTIONS" See \*(L"\s-1FUNCTIONS\*(R"\s0 in Math::PlanePath for behaviour common to all path classes. .ie n .IP """$path = Math::PlanePath::AnvilSpiral\->new ()""" 4 .el .IP "\f(CW$path = Math::PlanePath::AnvilSpiral\->new ()\fR" 4 .IX Item "$path = Math::PlanePath::AnvilSpiral->new ()" .PD 0 .ie n .IP """$path = Math::PlanePath::AnvilSpiral\->new (wider => $integer, n_start => $n)""" 4 .el .IP "\f(CW$path = Math::PlanePath::AnvilSpiral\->new (wider => $integer, n_start => $n)\fR" 4 .IX Item "$path = Math::PlanePath::AnvilSpiral->new (wider => $integer, n_start => $n)" .PD Create and return a new anvil spiral object. An optional \f(CW\*(C`wider\*(C'\fR parameter widens the spiral path, it defaults to 0 which is no widening. .SH "OEIS" .IX Header "OEIS" Entries in Sloane's Online Encyclopedia of Integer Sequences related to this path include .Sp .RS 4 (etc) .RE .PP .Vb 6 \& default wider=0, n_start=1 \& A033570 N on X axis, alternate pentagonals (2n+1)*(3n+1) \& A126587 N on Y axis \& A136392 N on Y negative (n=\-Y+1) \& A033568 N on X=Y diagonal, alternate second pents (2*n\-1)*(3*n\-1) \& A085473 N on south\-east diagonal \& \& wider=0, n_start=0 \& A211014 N on X axis, 14\-gonal numbers of the second kind \& A139267 N on Y axis, 2*octagonal \& A049452 N on X negative, alternate pentagonals \& A033580 N on Y negative, 4*pentagonals \& A051866 N on X=Y diagonal, 14\-gonal numbers \& A094159 N on north\-west diagonal, 3*hexagonals \& A049453 N on south\-west diagonal, alternate second pentagonal \& A195319 N on south\-east diagonal, 3*second hexagonals \& \& wider=1, n_start=0 \& A051866 N on X axis, 14\-gonal numbers \& A049453 N on Y negative, alternate second pentagonal \& A033569 N on north\-west diagonal \& A085473 N on south\-west diagonal \& A080859 N on Y negative \& A033570 N on south\-east diagonal \& alternate pentagonals (2n+1)*(3n+1) \& \& wider=2, n_start=1 \& A033581 N on Y axis (6*n^2) except for initial N=2 .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" Math::PlanePath, Math::PlanePath::SquareSpiral, Math::PlanePath::OctagramSpiral, Math::PlanePath::HexSpiral .SH "HOME PAGE" .IX Header "HOME PAGE" .SH "LICENSE" .IX Header "LICENSE" Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Kevin Ryde .PP This file is part of Math-PlanePath. .PP Math-PlanePath is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. .PP Math-PlanePath is distributed in the hope that it will be useful, but \&\s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE.\s0 See the \s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with Math-PlanePath. If not, see .