ON THE ROOTS OF DIOPHANTINE EQUATIONS mod(x n + Y n, P) = 0

Similar documents
DIOCESE OF HARRISBURG MATHEMATICS CURRICULUM GRADE 8

Appendix 14C: TIMSS 2015 Eighth Grade Mathematics Item Descriptions Developed During the TIMSS 2015 Benchmarking

The Ultimate Maths Vocabulary List

Student Name: Teacher: Date: Miami-Dade County Public Schools. Test: 9_12 Mathematics Geometry Exam 2

Each point P in the xy-plane corresponds to an ordered pair (x, y) of real numbers called the coordinates of P.

ON LINES AND THEIR INTERSECTION POINTS IN A RECTANGULAR GRID OF POINTS. 1. Introduction In an m n rectangular grid of points (here m = 4, n = 6)

Grades 7 & 8 Pre-Algebra/Course 3,

This image cannot currently be displayed. Course Catalog. Pre-algebra Glynlyon, Inc.

CMP Book: Investigation Number Objective: PASS: 1.1 Describe data distributions and display in line and bar graphs

EXPLORE MATHEMATICS TEST

Lemma (x, y, z) is a Pythagorean triple iff (y, x, z) is a Pythagorean triple.

Using the Best of Both!

Curriculum Catalog

UNIT 5: GEOMETRIC AND ALGEBRAIC CONNECTIONS. Apply Geometric Concepts in Modeling Situations

Geometry R. Unit 12 Coordinate Geometry. Day Classwork Day Homework Wednesday 3/7 Thursday 3/8 Friday 3/9

Curriculum Catalog

Honors Precalculus: Solving equations and inequalities graphically and algebraically. Page 1

CURRICULUM CATALOG. CCR Mathematics Grade 8 (270720) MS

Performance Level Descriptors. Mathematics

Prentice Hall Mathematics: Course Correlated to: Massachusetts State Learning Standards Curriculum Frameworks (Grades 7-8)

Mathematics 700 Unit Lesson Title Lesson Objectives 1 - INTEGERS Represent positive and negative values. Locate integers on the number line.

Morgan County School District Re-3. Pre-Algebra 9 Skills Assessment Resources. Content and Essential Questions

Gateway Regional School District VERTICAL ALIGNMENT OF MATHEMATICS STANDARDS Grades 5-8

1 Transforming Geometric Objects

Prep 8 Year: Pre-Algebra Textbook: Larson, Boswell, Kanold & Stiff. Pre-Algebra. Common Core Edition Holt McDougal, 2012.

Isometries. 1 Identifying Isometries

Name Date Grade Mathematics K

11.2 RECTANGULAR COORDINATES IN THREE DIMENSIONS

Middle School Math Course 3

Read, write compare and order numbers beyond 1000 in numerals and words Read Roman numerals to 100 and understand how they have changed through time

Prime Time (Factors and Multiples)

Mathematics II Resources for EOC Remediation

Course Outlines. Elementary Mathematics (Grades K-5) Kids and Numbers (Recommended for K-1 students)

Grade 7 Math Curriculum Map Erin Murphy

Anadarko Public Schools MATH Power Standards

Grade 8. Strand: Number Specific Learning Outcomes It is expected that students will:

Mathematics RIT Score:

A Framework for Achieving the Essential Academic Learning. Requirements in Mathematics Grades 8-10 Glossary

Grade 9 Math Terminology

Math Content

CHAPTER 2 REVIEW COORDINATE GEOMETRY MATH Warm-Up: See Solved Homework questions. 2.2 Cartesian coordinate system

Middle School Math Course 2

1 Transforming Geometric Objects

Exam 2 Review. 2. What the difference is between an equation and an expression?

Introduction to Geometry

8 th Grade Pre Algebra Pacing Guide 1 st Nine Weeks

Caltech Harvey Mudd Mathematics Competition March 3, 2012

Three-Dimensional Coordinate Systems

8.NS.1 8.NS.2. 8.EE.7.a 8.EE.4 8.EE.5 8.EE.6

Results of computer search for a perfect cuboid

Name Hr. Honors Geometry Lesson 9-1: Translate Figures and Use Vectors

Modular Arithmetic. is just the set of remainders we can get when we divide integers by n

WAYNESBORO AREA SCHOOL DISTRICT CURRICULUM ACCELERATED GEOMETRY (June 2014)

FORMULAS to UNDERSTAND & MEMORIZE

Bracken County Schools Curriculum Guide Geometry

Smarter Balanced Vocabulary (from the SBAC test/item specifications)

The x coordinate tells you how far left or right from center the point is. The y coordinate tells you how far up or down from center the point is.

Module Four: Connecting Algebra and Geometry Through Coordinates

Montana City School GRADE 5

Size Transformations in the Coordinate Plane

Kate Collins Middle School Pre-Algebra Grade 6

CURRICULUM UNIT MAP 1 ST QUARTER

TOPICS. Integers Properties of addition and. Rational Numbers Need for rational numbers. Exponents or Powers Introduction to Exponents or

An Investigation of Closed Geodesics on Regular Polyhedra

Number/Computation. addend Any number being added. digit Any one of the ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9

Math 462: Review questions

Arithmetic. Edexcel Primary curriculum. Mathematics Grade 6. S.no Topics Levels

Contents. PART 1 Unit 1: Number Sense. Unit 2: Patterns and Algebra. Unit 3: Number Sense

Greencastle-Antrim School District Planned Course Board Approved: March 2010

r the COR d e s 3 A lg e b r a Alabama Pathways

Prentice Hall. Connected Mathematics 2, 7th Grade Units Mississippi Mathematics Framework 2007 Revised, Grade 7

r the COR d e s 3 A lg e b r a New York Common Core Pathways

Areas of Planar Regions WORK SHEETS 1

Y7 Learning Stage 1. Y7 Learning Stage 2. Y7 Learning Stage 3

Unit 6: Connecting Algebra and Geometry Through Coordinates

Prentice Hall Mathematics: Course Correlated to: The Pennsylvania Math Assessment Anchors and Eligible Content (Grade 8)

Glossary Common Core Curriculum Maps Math/Grade 6 Grade 8

Middle School Math 3 and 8th GLEs

Standard Chapter/Unit Notes

Birkdale High School - Higher Scheme of Work

Maintaining Mathematical Proficiency

Illinois Math Assessment Framework, Grade 7. correlated to

IMO Training 2010 Double Counting Victoria Krakovna. Double Counting. Victoria Krakovna

Mathematics. Scheme of Work. Year 7. New Mathematics Framework

Prentice Hall Mathematics: Pre-Algebra 2004 Correlated to: Colorado Model Content Standards and Grade Level Expectations (Grade 8)

On Your Own. Applications. Unit 3. b. AC = 8 units y BD = 16 units C(5, 2)

Geometry Curriculum Map

High School Geometry. Correlation of the ALEKS course High School Geometry to the ACT College Readiness Standards for Mathematics

Nomo Triples. Dr Hugh Hunt of Cambridge University presented this lovely question at Maths Jam 2010.

Geometry Foundations Planning Document

FOUNDATION HIGHER. F Autumn 1, Yr 9 Autumn 2, Yr 9 Spring 1, Yr 9 Spring 2, Yr 9 Summer 1, Yr 9 Summer 2, Yr 9

The Three Dimensional Coordinate System

COORDINATE GEOMETRY. 7.1 Introduction

Texas High School Geometry

Math Lesson Plan 6th Grade Curriculum Total Activities: 302

Ready To Go On? Skills Intervention 9-1 Developing Formulas for Triangles and Quadrilaterals

7.1 a, b, c, d a, b 7.15 a, b, c 8.15 a, b 1 7, , , 1 3, Textboo k. 8.1a 8.4 a, b. 8.1b MU 2, 3 GS 17 IXL

GTPS Curriculum Mathematics Grade 8

Unit 3 Higher topic list

Unit Maps: Grade 8 Math

Transcription:

ON THE ROOTS OF DIOPHANTINE EQUATIONS mod(x n + Y n, P) = 0 SEPPO MUSTONEN Abstract. This is a report of numerical and graphical experiments about the roots of Diophantine equations of the form mod(x n + Y n, P) = 0. Example: https://www.survo.fi/demos/index.html#ex130 Figure 1. Roots for n = 32, P = 641, 0 X, Y 2 641 Date: 21 August 2018. 1

2 SEPPO MUSTONEN I have been developing the Survo software for statistical data analysis and graphics since 1960 ies. Especially during the last decades I have tested the functions of Survo by numerical and graphical examples related to purely mathematical subjects [1] - [7]. The first paper [1] related to roots of the Pythagorean equation X 2 + Y 2 = Z 2 led me to make plots of the roots of Diophantine equations X a + Y b = cz for various combinations of randomly selected positive integers a, b, c as shown in the Survo demo https://www.survo.fi/demos/index.html#ex121 This simple experiment revealed some interesting cases and let me study the topic more specifically. When computing numerical values of mod(x a + Y b, c) modular exponentiation [8] is used in the Survo module DIOPH which I created for numerical solving of Diophantine equations of this kind. According to my first experiments, nontrivial roots for Diophantine equations X 4 + Y 4 = cz are obtained for primes of the form c = 8n +1 and their multiples. In the demo https://www.survo.fi/demos/index.html#ex122 the roots are calculated and plotted for these c values until 433. The first target was the case X 4 + Y 4 = 17Z or mod(x 4 + Y 4, 17) = 0 documented as https://www.survo.fi/demos/index.html#ex123 and it showed that the roots (X, Y ) are located in the integer points of lines Y = 17 + k(x 17i), k = 2, 1/2, 1/2, 2, i Z and thus forming two slanted grids of squares so that all solutions can be covered by straight lines with 4 different slopes. In the comments of this demo more examples of cases mod(x 4 + Y 4, P) = 0 where P is a prime of the form P = 8n + 1 are shown. In them all solutions (X, Y ) can be covered by straight lines with 4 different slopes

ON THE ROOTS OF DIOPHANTINE EQUATIONS mod(x n + Y n, P) = 0 3 of the form p/q, q/p, p/q, q/p where p and q are small integers. According to my experiments, interesting symmetric configurations of roots (X, Y ) for Diophantine equations mod(x n + Y n, c) = 0 are obtained when n = 2 m k and c = 2 m+1 i + 1 is a prime, k, m, i = 1, 2,... as shown in https://www.survo.fi/demos/index.html#ex124 There the roots are plotted for X, Y = 0, 1, 2,..., 2c. Then a common feature in all these graphs is that the square determined by points (0, 0) and (2c, 2c) is divided into four subsquares of size c having identical configuration of points. In any of them, say in the square (0, c) the points are symmetric to both diagonals since when mod(x n +Y n, c) = 0 also mod(y n +X n, c) = 0 and mod((c X) n +(c Y ) n, c) = 0 when n is even. Then, for example, the configuration of points in the triangle with vertices (0, 0), (0, c/2), (c/2, c/2) determines the entire graph by rotations and translations. Due to these symmetric properties, a unique symmetric pattern (B) locates around the middle point (c, c) and symmetric patterns of another kind (A) are located around middle points of the four corner squares. This basic structure covers the entire XY space. The graphs created in the previous demos related to roots (X, Y ) of Diophantine equations mod(x n + Y n, c) = 0 have a lot of symmetrical (kaleidoscopic) features. Using the case mod(x 32 + Y 32, 641) = 0 as an example it is shown in the demo https://www.survo.fi/demos/index.html#ex125 how the graph of of roots (X, Y ) for X, Y = 0, 1,..., 2 641 = 1282 can be generated from a small triangular part of it by using that part or its transpose as a building block 32 times. A graph of this case is displayed also on the cover page of this paper. When finding solutions (X, Y ) for Diophantine equations mod (X n +Y n, P) = 0 where n is even, (P, P) is always one solution. If (P +p, P +q) is another solution, it is easy to see that (P +2p, P +2q), (P +3p, p+3q),... are also solutions and the points of solutions (P + kp, P + kq), k = 0, 1, 2,... are on the same straight line in the XY plane. The most visible clusterings appear for small p, q values giving series of solutions where the distance between consecutive points is the square root of p 2 + q 2. Suitable p, q values are found by applying the DIOPH operation of Survo for values 0 X, Y M where M can be considerably smaller than P. Then the list of solutions (X, Y ) is reduced by cancelling cases where gcd(x, Y ) > 1 and X > Y. Thereafter by sorting the list in ascending order of X 2 + Y 2 the best p, q combinations and related sets of straight lines are found. The entire set of these lines for given p, q values is Y = P ± p/q(x i/pp), Y = P ± q/p(x i/qp), i = 2, 1, 0, 1, 2,... For finding linear clusterings numerically a sucro /DIOPH was created.

4 SEPPO MUSTONEN *TUTSAVE DIOPH / / def Wm=W1 Wm2=W2 Wprime=W3 Wn=W4 / *{R} *SCRATCH {act}{home} *DIOPH {write Wm},{write Wm2},{write Wprime},{write Wn},CUR+4{act} *{R} *FILE COPY DIOPH1 TO NEW DIOPH{R} *DATA DIOPH1{R} *p q{r} / The results of DIOPH are saved{r} / in a Survo data file DIOPH as variables p,q.{r} *{u3}{act} *SCRATCH {act}{home} *VAR G:2=gcd(p,q) TO DIOPH{act}{R} *VAR C1:1=if(p>q)then(0)else(1) TO DIOPH{act}{R} *VAR C2:1=if(G>1)then(0)else(1) TO DIOPH{act}{R} *VAR C3:1=C1*C2 TO DIOPH{act}{R} *FILE COPY DIOPH TO NEW DIOPH2 / IND=C3,1{act}{R} *VAR R:2=sqrt(p*p+q*q) TO DIOPH2{act}{R} *FILE SORT DIOPH2 BY R TO DIOPH3{act}{R} *FILE LOAD DIOPH3 / IND=ORDER,2,20 VARS=p,q,R{act} *{end} When applied to the current case mod(x 32 + Y 32, 641) = 0 /DIOPH gives the following result: /DIOPH 32,32,641,100 DIOPH 32,32,641,100,CUR+4 / n_comb=533 The results of DIOPH are saved in a Survo data file DIOPH as variables p,q. VAR G:2=gcd(p,q) TO DIOPH VAR C1:1=if(p>q)then(0)else(1) TO DIOPH VAR C2:1=if(G>1)then(0)else(1) TO DIOPH VAR C3:1=C1*C2 TO DIOPH FILE COPY DIOPH TO NEW DIOPH2 / IND=C3,1 VAR R:2=sqrt(p*p+q*q) TO DIOPH2 FILE SORT DIOPH2 BY R TO DIOPH3 FILE LOAD DIOPH3 / IND=ORDER,2,20 VARS=p,q,R DATA DIOPH3*,A,B,C p q R 1 2 2 1 5 5 4 5 6 1 8 8 9 13 15

ON THE ROOTS OF DIOPHANTINE EQUATIONS mod(x n + Y n, P) = 0 5 5 16 16 1 20 20 2 25 25 8 25 26 17 27 31 1 32 32 21 31 37 13 36 38 19 33 38 23 33 40 25 32 40 3 41 41 12 41 42 29 31 42 Formulas for all the points of solution (X, Y ) are obtained as follows. The essential p, q combinations are found by using the DIOPH command of Survo. For each combination the roots (X, Y ) are located equidistantly on lines (1) Y = P + p/q(x i/pp), i = 2, 1, 0, 1, 2,... The equations (1) can be written in the form (2) px qy = (i q)p, i = 2, 1, 0, 1, 2,... Then the Diophantine equation (3) px qy = 1, is solved by the extended Euclidean algorithm giving roots (X 0, Y 0 ) and we get a basic solution (4) X 1 = (i q)px 0, Y 1 = (i q)py 0. Then the general solution will be (5) X = ipx 0 + qt, Y = ipy 0 + pt, i, t = 2, 1, 0, 1, 2,... This derivation of the solution in the case (p, q) is not needed in cases (q, p), (p, q), ( q, p) since when (X, Y ) is a solution for (5) also (Y, X), (P X, P Y ), (P Y, P X) are solutions. In general, the graph of the roots (X, Y ) of the Diophantine equation mod(x n + Y n, P) = 0 can always be covered by square grids so that all integer points of grids are roots. In the case n = 2 m at most 2 m 1 square grids are needed and the p, q pairs for defining these grids are the first 2 m 2 pairs given by the sucro /DIOPH. For other n values the number of square grids is smaller. The graphs related to roots (X, Y ) of Diophantine equations mod(x n +Y n, P) = 0 have a lot of symmetrical properties. It is easy to see that if (X, Y ) is a root in the area 0 X, Y P, also (Y, X), (X, P Y ), (P Y, X), (P X, Y ), (Y, P X), (P X, P Y ), (P Y, P X)

6 SEPPO MUSTONEN are roots in the same area. At the same time also (kx, ky ), k = 0, 1, 2,... as well their 7 counterparts (ky, kx), (kx, P ky ),... are roots. The minimal solutions (X, Y ) with smallest gaps X 2 + Y 2 provide the optimal starting points (X, Y ) for finding all roots in the area 0 X, Y P (P square). In the demo https://www.survo.fi/demos/index.html#ex126 it is shown how all roots in the case n = 32, P = 641 in the area 0 X, Y 641 are found by the sucro /DIOPH and by an extended version of of DIOPH2 module of Survo by starting from minimal solutions and using the symmetrical and multiplicity features just described. The roots (X, Y ) located in the P square and related to a minimal solution (p, q) are equidistantly on parallel lines (6) X = ipx 0 + qt, Y = ipy 0 + pt, i = q, q + 1,..., p 1, p where X 0 and Y 0 are obtained from the Diophantine equation px 0 + qy 0 = 1. The line for a given value of i encounters the line connecting the diagonal of the P square with end points (0, P) and (P, 0) in the point determined by t = P(1 i(x 0 +Y 0 ))/(p+q). When t is rounded to the closest integer t 0, the point of solution X 1 = ipx 0 + qt 0, Y 1 = ipy 0 + pt 0 is located in the P square (or in its corner for i = q and i = p). Then it is easy to determine all points of solution in the P square related to to minimal solution p, q by using (6) and by the basic properties given above. In the demo https://www.survo.fi/demos/index.html#ex127 a general procedure is presented for determining how many minimal solutions are needed in each case. The p, q values will be processed in the order given by /DIOPH until in the set of solutions (X, Y ) the next pair (p, q) already appears among those solutions. Thus the top values in the list of p, q values from /DIOPH should give minimal solutions. This view is supported e.g. by the fact that a small distance p 2 + q 2 between consecutive roots implies thicker covering of roots than a big distance. Thus this principle guarantees an economic approach for finding all roots. The following snapshot of the demo ex127 tells how the sucro /D SOLVE works in the case n = 64, P = 641: 1 * 2 * Automatic solution of Diophantine equations mod(x^n+y^n,p)=0 3 * 4 *I have created a new sucro /D_SOLVE for finding the numbers p,q 5 *and associated straight lines covering all solution points (X,Y) 6 *of the Diophantinec equation mod(x^n+y^n,p)=0. 7 *It is sufficient to study the area 0<=X,Y<=P. 8 *All roots in this area are determined by using /DIOPH and listed. 9 *At first a reasonable number of basic solutions (smallest roots X,Y) 10 *are computed and sorted in increasing order according to X^2+Y^2. 11 *Then by starting from the first p,q pair the points of solution related 12 *to solution (p,q)=(x,y) according to the symmetry and multiplicity 13 *relations described in the previous demo are removed from the list. 14 *This process is continued until all points in the list have been 15 *removed and this procedure gives the number of essential p,q pairs.

ON THE ROOTS OF DIOPHANTINE EQUATIONS mod(x n + Y n, P) = 0 7 16 *It is possible (typically for the last pairs) that some p,q pairs 17 *do not remove any points. Such pairs are eliminated. 18 * 19 *For example, in the case n=64, P=641 the number of p,q pairs is 16, 20 *but 17 pairs has to be processed since the last two pairs are 21 *(11,24),(16,21) and 11^2+24^2=16^2+21^2=697 (equal distances). 22 *(11,24) removes no points from the list, but (16,21) empties the list. 23 * 24 */D_SOLVE 64,64,641,100,20 / Basic solutions <100, 20 p,q pairs to test 25 * 26 *Solving Diophantine equation mod(x^64+y64,641)=0 27 * 28 *DIOPH 64,64,641,100,CUR+4 / n_comb=995 29 *VAR G:2=gcd(p,q) TO DIOPH 30 *VAR C1:1=if(p>q)then(0)else(1) TO DIOPH 31 *VAR C2:1=if(G>1)then(0)else(1) TO DIOPH 32 *VAR C3:1=C1*C2 TO DIOPH 33 *FILE COPY DIOPH TO NEW DIOPH2 / IND=C3,1 34 *VAR R=sqrt(p*p+q*q) TO DIOPH2 35 *FILE SORT DIOPH2 BY R TO DIOPH3 36 *FILE LOAD DIOPH3 / IND=ORDER,2,21 VARS=p,q,R 37 * 38 *MAT SAVE AS PQ 39 *MAT PQ_X0Y0=ZER(20,5) 40 *MAT PQ_X0Y0(1,1)=PQ 41 * 42 *Solving 20 Euclidean equations p*x0-q*y0=1 43 *MAT_PQ_X0Y0(20,1) 20 44 *MAT_PQ_X0Y0(20,2) 21 45 *EUCLID 20,21 46 *-1 1 1 47 * 48 *MAT PQ_X0Y0(20,1)=21 49 *MAT PQ_X0Y0(20,2)=20 50 *MAT PQ_X0Y0(20,4)=1 51 *MAT PQ_X0Y0(20,5)=1 52 * 53 *MAT NAME PQ_X0Y0 AS p_q_x0_y0_values_for_n=64_p=641 54 *Matrix PQ_X0Y0 of p,q,x0,y0 values created! 55 *Computing roots: 56 * 57 *SLOPES=PQ_X0Y0 POINTS=A64_641.TXT 58 *DIOPH3 64,64,641,641,CUR+1 / n_comb=0 59 * 60 *Number of slopes needed is 16. 61 * 62 *DIOPH has saved the validities of p,q combinations in a text file 63 *#VALID.TXT. These values (0 or 1) shall appear as a column valid

8 SEPPO MUSTONEN 64 *in the table of results. 65 * 66 *Values of p,q,r,x0,y0,valid for these 16 slopes are: 67 *(Rejected p,q combinations indicated by 0 s in the last column) 68 */// p q R X0 Y0 valid 69 * 1 3 11 11 4 1 1 70 * 2 6 11 13 2 1 1 71 * 3 12 11 16 1 1 1 72 * 4 15 11 19 3 4 1 73 * 5 1 21 21 1 0 1 74 * 6 19 9 21 1 2 1 75 * 7 21 2 21 1 10 1 76 * 8 21 4 21 1 5 1 77 * 9 21 5 22 1 4 1 78 * 10 22 3 22 1 7 1 79 * 11 8 21 22 8 3 1 80 * 12 13 19 23 3 2 1 81 * 13 21 10 23 1 2 1 82 * 14 23 9 25 2 5 1 83 * 15 19 18 26 1 1 1 84 * 16 11 24 26 11 5 0 / eliminated p,q pair 85 * 17 16 21 26 4 3 1 86 * 87 *Number of slopes needed is 16. 88 * 89 *# of points 0<=X,Y<=641 is 40964. 90 *Density of points is round(40964/641^2,4)=0.0997 91 * 92 *... 93 *Plotting the graph for 0<=X,Y<=2*641: 94 * 95 *4*40964+300 164156 96 *REDIM 164156,120 / More rows in the edit field! 97 *WSTYLE=0 HEADER= XLABEL= YLABEL= XDIV=0,1,0 YDIV=0,895,30 FRAME=3 98 *WSIZE=895,925 WHOME=872,0 POINT=6,3 MODE=2000,2000 TEXTS=T 99 * 100 *T=[SwissB(70)],mod(X^64+Y^64;641)_=_0 X;Y=0(1)1282,100,1925 101 *DIOPH 64,64,641,1282,CUR+4 / n_comb=163849 102 *GPLOT K,X,Y / SCALE=0,1282 POINT=0,3 103 *DATA K 104 *X Y 105 *0 0 106 *0 641 107 *0 1282 108 *1 21 109 *1 29 110 *....

ON THE ROOTS OF DIOPHANTINE EQUATIONS mod(x n + Y n, P) = 0 9 Figure 2. Roots for n = 64, P = 641, 0 X, Y 2 641 By using this technique I have solved over 100 cases with various n and P values. The results of these experiments support the following conjecture about the number of p, q pairs needed: Assume that P is a prime number. The trivial roots (X, Y ) of mod(x n +Y n, P) = 0 are (ip, jp), i, j =..., 2, 1, 1, 2,... Let the P 1 be divisible by 2 k but not by 2 k+1. Then non-trivial roots can appear only when n < 2 k. For any even n < 2 k giving also nontrivial roots, the number of p, q combinations needed for straight lines to cover the roots (X, Y ) in the XY plane is (7) N(n, P) = gcd(n, P 1)/4. Example: N(64, 641) = 16 The above N(n, P) formula holds in all cases I have tested and they are listed in https://www.survo.fi/demos/ex127_pq.txt (# of roots and slopes in 120 cases and lists of some interesting p, q values). In some cases as for n = 64, P = 641 all optimal p, q combinations do not appear in the order determined by p 2 + q 2. Tables of p, q combinations of such

10 SEPPO MUSTONEN cases are also given at the end of this list. Covering the points of solution by orthogonal grids with various slopes may happen in multiple ways depending on the order of p, q combinations suggested. So far the order has been determined by the gap p 2 + q 2 between consecutive points on a particular straight lines determined by p/q. Replacing p 2 + q 2 by (p 4 + q 4 ) 1/4 or min(p, q) may lead to different optimal selections. However, in all cases the number of essential combinations is the same. Also when n is odd, the lines determining the locations of the the roots of mod(x n + Y n, P) = 0 can be obtained by the principles described in this demo. The number of different slopes of straight lines needed to cover all the roots is according to my latest experiments is simply #slopes(n, P) = gcd(n, P 1) when P is a prime number and this is valid also for even n values. This is equivalent with the previous formula (7) of N(n, P) giving the number of p, q combinations for any even n, because then each p, q combination corresponds to 4 different slopes. For odd values of n the first slope is always 1 since all (X, X) s are roots. Also in this case when (X, Y ) is a root then (Y, X) is a root. The demonstration https://www.survo.fi/demos/index.html#ex128 shows plotting of five examples in the order the DIOPH3 program module finds the roots in a slow speed so that the user can see the final graph emerging through symmetric steps. This takes place by using a specification POINTS2=1 in the sucro command /D SOLVE which saves the roots in a text file POINTS.TXT and activates thereafter the DIOPH3 operation to display the graph in slow motion. The graphs can be enhanced by using colors so that points related to directions specified by the same p, q numbers have the same color. This is shown in demos https://www.survo.fi/demos/index.html#ex129, https://www.survo.fi/demos/index.html#ex130, and especially in their YouTube versions. References [1] S.Mustonen, Pythagorean triples: visualization and characterization, (2005) https://www.survo.fi/papers/pythagorean3.pdf [2] S.Mustonen, Statistical accuracy of geometric constructions, (2008) https://www.survo.fi/papers/geomaccuracy.pdf [3] S.Mustonen, On lines and their intersection points in a rectangular grid of points, (2009) https://www.survo.fi/papers/pointsingrid.pdf [4] S.Mustonen, On lines through a given number of points in a rectangular grid of points, (2010) https://www.survo.fi/papers/linesingrid2.pdf [5] S.Mustonen, Simple constructions of regular n-sided polygons at any given accuracy, (2013) https://www.survo.fi/papers/polygons2013.pdf [6] S.Mustonen, Lengths of edges and diagonals and sums of them in regular polygons as roots of algebraic equations, (2013) https://www.survo.fi/papers/roots2013.pdf [7] S.Mustonen, On the roots of an algebraic equation related to regular polygons, (2017) https://www.survo.fi/papers/roots2017.pdf [8] Modular exponentiation, https://en.wikipedia.org/wiki/modular_exponentiation Department of Mathematics and Statistics, University of Helsinki E-mail address: seppo.mustonen@survo.fi