1Math::PlanePath::CoprimUesCeorluCmonnst(r3i)buted Perl DMoactuhm:e:nPtlaatnieoPnath::CoprimeColumns(3)
2
3
4

NAME

6       Math::PlanePath::CoprimeColumns -- coprime X,Y by columns
7

SYNOPSIS

9        use Math::PlanePath::CoprimeColumns;
10        my $path = Math::PlanePath::CoprimeColumns->new;
11        my ($x, $y) = $path->n_to_xy (123);
12

DESCRIPTION

14       This path visits points X,Y which are coprime, ie. no common factor so
15       gcd(X,Y)=1, in columns from Y=0 to Y<=X.
16
17           13 |                                          63
18           12 |                                       57
19           11 |                                    45 56 62
20           10 |                                 41    55
21            9 |                              31 40    54 61
22            8 |                           27    39    53
23            7 |                        21 26 30 38 44 52
24            6 |                     17          37    51
25            5 |                  11 16 20 25    36 43 50 60
26            4 |                9    15    24    35    49
27            3 |             5  8    14 19    29 34    48 59
28            2 |          3     7    13    23    33    47
29            1 |    0  1  2  4  6 10 12 18 22 28 32 42 46 58
30           Y=0|
31              +---------------------------------------------
32              X=0  1  2  3  4  5  6  7  8  9 10 11 12 13 14
33
34       Since gcd(X,0)=0 the X axis itself is never visited, and since
35       gcd(K,K)=K the leading diagonal X=Y is not visited except X=1,Y=1.
36
37       The number of coprime pairs in each column is Euler's totient function
38       phi(X).  Starting N=0 at X=1,Y=1 means N=0,1,2,4,6,10,etc horizontally
39       along row Y=1 are the cumulative totients
40
41                                 i=K
42           cumulative totient = sum   phi(i)
43                                 i=1
44
45       Anything making a straight line etc in the path will probably be
46       related to totient sums in some way.
47
48       The pattern of coprimes or not within a column is the same going up as
49       going down, since X,X-Y has the same coprimeness as X,Y.  This means
50       coprimes occur in pairs from X=3 onwards.  When X is even the middle
51       point Y=X/2 is not coprime since it has common factor 2 from X=4
52       onwards.  So there's an even number of points in each column from X=2
53       onwards and those cumulative totient totals horizontally along X=1 are
54       therefore always even likewise.
55
56   Direction Down
57       Option "direction => 'down'" reverses the order within each column to
58       go downwards to the X axis.
59
60           direction => "down"
61
62            8 |                           22
63            7 |                        18 23        numbering
64            6 |                     12              downwards
65            5 |                  10 13 19 24            |
66            4 |                6    14    25            |
67            3 |             4  7    15 20               v
68            2 |          2     8    16    26
69            1 |    0  1  3  5  9 11 17 21 27
70           Y=0|
71              +-----------------------------
72              X=0  1  2  3  4  5  6  7  8  9
73
74   N Start
75       The default is to number points starting N=0 as shown above.  An
76       optional "n_start" can give a different start with the same shape,  For
77       example to start at 1,
78
79           n_start => 1
80
81            8 |                           28
82            7 |                        22 27
83            6 |                     18
84            5 |                  12 17 21 26
85            4 |               10    16    25
86            3 |             6  9    15 20
87            2 |          4     8    14    24
88            1 |    1  2  3  5  7 11 13 19 23
89           Y=0|
90              +------------------------------
91              X=0  1  2  3  4  5  6  7  8  9
92

FUNCTIONS

94       See "FUNCTIONS" in Math::PlanePath for behaviour common to all path
95       classes.
96
97       "$path = Math::PlanePath::CoprimeColumns->new ()"
98       "$path = Math::PlanePath::CoprimeColumns->new (direction => $str,
99       n_start => $n)"
100           Create and return a new path object.  "direction" (a string) can be
101
102               "up"       (the default)
103               "down"
104
105       "($x,$y) = $path->n_to_xy ($n)"
106           Return the X,Y coordinates of point number $n on the path.  Points
107           begin at 0 and if "$n < 0" then the return is an empty list.
108
109       "$bool = $path->xy_is_visited ($x,$y)"
110           Return true if "$x,$y" is visited.  This means $x and $y have no
111           common factor.  This is tested with a GCD and is much faster than
112           the full "xy_to_n()".
113

BUGS

115       The current implementation is fairly slack and is slow on medium to
116       large N.  A table of cumulative totients is built and retained up to
117       the highest X column number used.
118

OEIS

120       This pattern is in Sloane's Online Encyclopedia of Integer Sequences in
121       a couple of forms,
122
123           <http://oeis.org/A002088> (etc)
124
125           n_start=0 (the default)
126             A038567    X coordinate, reduced fractions denominator
127             A020653    X-Y diff, fractions denominator by diagonals
128                          skipping N=0 initial 1/1
129
130             A002088    N on X axis, cumulative totient
131             A127368    by columns Y coordinate if coprime, 0 if not
132             A054521    by columns 1 if coprime, 0 if not
133
134             A054427    permutation columns N -> RationalsTree SB N X/Y<1
135             A054428      inverse, SB X/Y<1 -> columns
136             A121998    Y of skipped X,Y among 2<=Y<=X, those not coprime
137             A179594    X column position of KxK square unvisited
138
139           n_start=1
140             A038566    Y coordinate, reduced fractions numerator
141
142             A002088    N on X=Y+1 diagonal, cumulative totient
143

SEE ALSO

145       Math::PlanePath, Math::PlanePath::DiagonalRationals,
146       Math::PlanePath::RationalsTree, Math::PlanePath::PythagoreanTree,
147       Math::PlanePath::DivisibleColumns
148

HOME PAGE

150       <http://user42.tuxfamily.org/math-planepath/index.html>
151

LICENSE

153       Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020
154       Kevin Ryde
155
156       Math-PlanePath is free software; you can redistribute it and/or modify
157       it under the terms of the GNU General Public License as published by
158       the Free Software Foundation; either version 3, or (at your option) any
159       later version.
160
161       Math-PlanePath is distributed in the hope that it will be useful, but
162       WITHOUT ANY WARRANTY; without even the implied warranty of
163       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
164       General Public License for more details.
165
166       You should have received a copy of the GNU General Public License along
167       with Math-PlanePath.  If not, see <http://www.gnu.org/licenses/>.
168
169
170
171perl v5.34.0                      2021-07-22Math::PlanePath::CoprimeColumns(3)
Impressum