<<

A Computational Exploration of Gaussian and Eisenstein Moats

By

Philip P. West

A DISSERTATION SUBMITTED IN PARTIAL FULFILLMENT OF THE

REQUIREMENTS FOR THE OF

MASTERS IN

()

at the

CALIFORNIA STATE UNIVERSITY CHANNEL ISLANDS

20 14 copyright 20 14

Philip P. West

ALL RIGHTS RESERVED APPROVED FOR THE MATHEMATICS PROGRAM

Brian Sittinger, Advisor Date: 21 December 20 14

Ivona Grzegorzyck Date: 12/2/14

Ronald Rieger Date: 12/8/14

APPROVED FOR THE UNIVERSITY

Doctor Gary A. Berg Date: 12/10/14 Non- Exclusive Distribution License

In for California State University Channel Islands (C S U C I) to reproduce, translate and distribute your submission worldwide through the C S U C I Institutional Repository, your agreement to the following terms is necessary. The authors retain any copyright currently on the item as well as the ability to submit the item to publishers or other repositories.

By signing and submitting this license, you (the authors or copyright owner) grants to C S U C I the nonexclusive right to reproduce, translate (as defined below), and/ or distribute your submission (including the abstract) worldwide in print and electronic format and in any medium, including but not limited to audio or video.

You agree that C S U C I may, without changing the content, translate the submission to any medium or format for the purpose of preservation.

You also agree that C S U C I may keep more than one copy of this submission for purposes of security, backup and preservation.

You represent that the submission is your original work, and that you have the right to grant the rights contained in this license. You also represent that your submission does not, to the best of your knowledge, infringe upon anyone's copyright. You also represent and warrant that the submission contains no libelous or other unlawful matter and makes no improper invasion of the privacy of any other person.

If the submission contains material for which you do not hold copyright, you represent that you have obtained the unrestricted permission of the copyright owner to grant C S U C I the rights required by this license, and that such third party owned material is clearly identified and acknowledged within the text or content of the submission. You take full responsibility to obtain permission to use any material that is not your own. This permission must be granted to you before you sign this form.

IF THE SUBMISSION IS BASED UPON WORK THAT HAS BEEN SPONSORED OR SUPPORTED BY AN AGENCY OR ORGANIZATION OTHER THAN C S U C I, YOU REPRESENT THAT YOU HAVE FULFILLED ANY RIGHT OF REVIEW OR OTHER OBLIGATIONS REQUIRED BY SUCH CONTRACT OR AGREEMENT.

The C S U C I Institutional Repository will clearly identify your names as the authors or owners of the submission, and will not make any alteration, other than as allowed by this license, to your submission.

Title of Item: A comutational exploration of Gaussian and Eisenstein Moats

3 to 5 keywords or phrases to describe theitem : Gaussian Moat, Eisenstein Moat, Eisenstein Prime Density

Authors Name(Print) : Philip P. West

Authors Signature Date: Dec 5, 20 14

This is a permitted, modified version of the Non- exclusive Distribution License from M I T Libraries and the University of Kansas. DEDICATION

I dedicate this paper to the following two influential women in my life. First, I acknowledge my wife Sharon Hines- West who has always been supportive of me, both with her encouragement and with her own knowledge of mathemat- ics. Secondly, I am grateful to my mother Doctor Julia S. West, who despite many personal struggles, received her doctorate at age 58 and taught her entire life right up to her passing at age 81. Her example inspired me to pursue this goal later in life.

roman numeral 4 ACKNOWLEDGEMENTS

This thesis would not have been possible without the support of the Mathe-

matics Department at California State University Channel Islands. In partic-

ular, I would like to thank my advisors Doctor Brian Sittinger, Ronald Rieger, and

Doctor. Ivona Grzegorczyk. I also would like to acknowledge Doctor Jorge Garcia for

his help formatting this thesis using Latex.

Camarillo, California

December 3, 20 14

v ABSTRACT

If one imagines the Gaussian primes to be lily pads in the pond of complex , could a frog hop from the origin to infinity with jumps of bounded size? If the frog was confined to the real line, the answer is no. Good heuristic arguments exist for it not being possible in the , but there is still no formal proof for this conjecture.

If the frog's journey terminates for a given hop size, it implies that a prime free "moat" greater than the hop size completely surrounds the origin.

In the Chauvenet Prize- winning paper "A Stroll Through the Gaussian Primes",

Ellen Gethner, Stan Wagon, and Brian Wick [4] explored this problem and by computational methods proved the existence of a of 26 -moat. Additionally they proved that prime-free neighborhoods of arbitrary radius k surrounding a Gaussian prime exist.

In their concluding remarks, Gethner et al. that "Similar questions about walks to infinity may be asked for the finitely many imaginary quadratic fields of class number 1."

1 This paper takes up that challenge by examining similar questions about walks to infinity in the of Eisenstein . By computational methods, we prove the existence of a bounding square root of l6 -moat in the Eisenstein primes and provide an estimate for the bounds of any square root of k -moat. A subtle difference be- tween the structure of Eisenstein and Gaussian integers results in our estimate being significantly different from our expectation.

2 TABLE OF CONTENTS

1 Introduction 5

2 Mathematical Background 9

2 1 Arithmetic in the Gaussian and Eisenstein Integers 9

2 point 2 The Chinese Remainder Theorem 12

2 point 3 Gaussian Moats (Gethner) 13

2 point 4 Gaussian Prime Density (Vardi) 17

2 point 5 Estimating Bounds on Gaussian Moats (Vardi) 18

3 Computational Background 21

3 point 1 Improved Computational Results (Tsuchimura) 21

3 point 2 Depth-first Search Algorithm 25

3 point 3 Multiple Precision Integers and Rationals Library 26

3 point 4 Miller- Rabin Primality Testing 27

4 Mathematical Results 31

4 point 1 Annular Moats 31

4 point 2 Eisenstein Prime Density 33

3 TABLE OF CONTENTS

4 point 3 Finding p parenthesis k parenthesis for a k- connected Eisenstein Prime Component 35

4 point 4 Estimating Methods for Bounding Eisenstein Moats 37

4 point 5 Generalizing Gethner's Proof to the Eisenstein Integers 39

5 Computational Results 45

5 point 1 Overview of Approach 45

5 point 2 k- Connected Gaussian Prime Algorithm 46

5 point 3 k- Connected Eisenstein Prime Algorithm 50

5 point 4 Gaussian Prime Viewer for Validation Purposes 54

5 point 5 Validation of Gaussian Moat Data 56

5 point 6 Eisenstein Moat Data 57

6 Conclusion 60

7 Appendix 65

7 point 1 Gethner's Proof Generalized for Imaginary Quadratic Integers 65

7 point 2 MAPLE Code for square root of 7-connected E- Prime Plot 71

7 point 3 C- code for Gaussian Prime Viewer 72

7 point 4 C- code for Eisenstein Prime Connected Components 77

Bibliography 87

4 Chapter 1

INTRODUCTION

Simple problems often lead to more interesting and difficult questions. For instance, is it possible to travel on the line to infinity by taking bounded steps on only the prime numbers? The answer is no and easily seen by showing arbitrarily large prime-free gaps exist on the number line by ob- serving that for any n greater than 1, parenthesis n plus 1 parenthesis plus2 , parenthesis n plus 1 parenthesis exclamation mark plus 3, dot dot, parenthesis n plus 1 parenthesis exclamation mark plus parenthesis n plus

1 parenthesis are n consecutive composite integers. Now that we know arbitrarily large gaps without primes exist on the real number line, then inquiring minds would ask, "Are there also Gaussian prime-free moats of arbitrarily large width that surround the origin in the complex plane?" The answer is, "Probably, but we have not been able to prove it."

5 A problem more analogous to the question about arbitrary prime free- gaps on the real line is whether two- dimensional prime-free neighborhoods of arbitrary radius k exist. This was proven by Gethner et al. in 19 98, [4]. We provide a direct modification of this proof from the Gaussian integers to the

Eisenstein integers.

Definition 1 point 0 point 1 (k- connected component) A of vertices in a graph whose vertices to each other by edges of length k or less. We will only consider the set of vertices representing Gaussian primes or the set of vertices representing Eisen- stein primes in the complex plane. In both cases, our connected component will always start with the element closest to the origin of the complex plane.

Gethner et al. provided computational proofs for the existence of Gaussian moats with the specific maximum distance reachable for all connected com- ponents surrounded by moats up to square root of 20. Additionally, they computationally demonstrated that a square root of 26 -moat exists, but only provided a bound for the max- imum reachable distance of its connected component.

Sometimes, applied mathematics can provide insights for solving abstract problems. For instance, Percolation Theory, which describes the behavior of connected clusters in a random graph, is used in material science to model

6 movement and filtering of fluids through porous materials. We will use this to provide insights into our problem which resides in theoretical mathematics.

In Vardi's paper "Prime Percolation" [10] , he shows that if we could assume prime numbers were truly random, then Percolation Theory predicts that for a sufficiently small density of random Gaussian primes, no infinite walk of a bounded step size exists. Moreover, it provides a heuristic reason that no infinite walk exists on the Gaussian primes, since they have arbitrarily small density over large regions. Vardi then proceeds to use his theory to make spe- cific estimates for the largest reachable distance for each connected compo- nent bounded by a given moat size. We use Vardi's method as modified by

Tsuchimura to estimate the bounds of Gaussian moats, and then we adapt it to estimate bounds of the Eisenstein moats.

Tsuchimura [9] provided more computational results for the Gaussian moats in 20 0 4 by calculating the maximum reachable distance for all k -connected components surrounded by moats up to size square root of 32. Additionally, he shows the existence of moats up to size square root of 36. Conflicting values for the square root of 20 -moat exist between the results obtained by Gethner and Tsuchimura. We validate

Tsuchimura's results for the Gaussian square root of 20 -moat

Tsuchimura also proposed improvements to Vardi's method of estimat-

7 ing the largest reachable distance of a Gaussian k -connected component and demonstrates a much higher statistical correlation of his results than those of

Vardi. We apply his improvements to our method derived from Vardi to esti- mate the largest reachable distance of a k -connected component surrounded by an Eisenstein moat of size square root of k .

For the computational results, we use programs developed in Microsoft

Visual Studio for C and utilize the Multiple Precision Integers and Rationals

(M PIR) library. M PIR is an open source multiprecision integer (bignum) li- brary forked from the G M P (G N U Multi Precision) project.

As a tool in aiding our exploration of this problem, we also developed a tool for viewing either Gaussian or Eisenstein primes of large magnitude. The viewing window can be easily reset to any large value, or scrolled horizontally or vertically for local exploration in the complex plane.

8 Chapter 2

MATHEMATICAL BACKGROUND

2 point 1 Arithmetic in the Gaussian and Eisenstein

Integers

An objective of Algebraic is to study rings which have arith- metic properties analogous to those of integer numbers set . In particular, we will consider the

Gaussian integers and the Eisenstein integers.

Definition 2 point 1 point 1 (Gaussian integers) The set of Gaussian integers, denoted by

integer numbers set symbol square i square bracket,i s defined as integer numbers set symbol square bracket i square bracket equals curly brace a plus b i vertical a b set

membership symbol integer numbers set symbol curly brace.Remar k 2 point 1 point 2 parenthesis a comma b parenthesisma y be used to refer to the on the com-

9 plex plane, or parenthesis a comma b parenthesisma y refer to an ordered pair of integers representing an edge in a connected component.

Definition 2 point 1 point 3 (Eisenstein integers) The set of Eisenstein integers, denoted by integer numbers set symbol w vertical bar, is defined as integer numbers set symbol vertical bar w vertical bar equals curly brace

a plus b w vertical bar a comma b set membership symbol integer numbers set symbol curly brace, where w equals negative 1 plus square root of negative 3 divided by 2 (which is a cube ).

These rings are known to be Euclidean domains and thus Unique Domains (U F D), [2, p.270 to 287].

Definition 2 point 1 point 4 (Units) In a R, we say that u is a if there exists v set membership symbol R such that u v equals1 . The set of all units in R is denoted as R .

Moreover, we say that r comma s set membership symbol R are associates if r equals u s us for some u set membership symbol R asterisk.

For instance, the units in our rings of interest are given as follows:

integer numbers set symbol asterisk equals curly brace plus minus 1 curly brace.

integer numbers set symbol square bracket i square bracket asterisk equals curly brace plus minus 1 comma plus minus i curly brace.

integer numbers set symbol vertical bar w vertical bar asterisk equals curly brace plus minus 1 comma plus minus w comma plus minus

w squared curly brace.

When dealing with the Gaussian integers, it is convenient to make comparisons between these numbers based on their distance from the origin. Al-

though the Euclidean distance and the Euclidean norm are synonymous in

10 most fields of mathematics, number theorists use a different definition of the norm.

Definition 2 point 1 point 5 parenthesis Gaussian norm parenthesis The norm of a Gaussian integer is defined as N parenthesis a plus b i parenthesis equals parenthesis a plus b i parenthesis equals parenthesis bar over a plus b i parenthesis equals

a squared plus b squared, where a plus b i set membership symbol integer numbers set symbol square bracket i square bracket .

Definition 2 point 1 point 6 parenthesis Eisenstein norm parenthesis The norm of an is defined as N parenthesis a plus b w parenthesis equals parenthesis a plus b w parenthesis parenthesis bar over a plus b w parenthesis equals a squared minus a b plus

b squared, where a plus b w set membership symbol integer numbers set symbol square bracket w square bracket.

Proposition 2 point 1 point 7 parenthesis Gaussian prime parenthesis A Gaussian integer a plus b i and its asso- ciates are prime if they satisfy one of the following, square bracket8 , p. 247 square bracket .

Both a and b are nonzero and N parenthesis a plus b i parenthesis is an ordinary prime congruent

to 1 mod 4 or 2 mod 4.

If b equals 0 and vertical bar a vertical bar is an ordinary prime such that vertical bar a vertical bar equivalence symbol 3 mod 4.

Proposition 2 point 1 point 8 parenthesis Eisenstein prime parenthesis An Eisenstein integer a plus b w and its as-

sociates are prime if they satisfy one of the following, square bracket 11 square bracket . Both a and b are nonzero and N parenthesis a plus b w parenthesis is an ordinary prime congruent to 0 mod 3 or 1

mod 3. If b equals 0 and vertical bar a vertical bar is an ordinary prime such that vertical bar a vertical bar equivalence symbol 2 mod 3.

11 2 point 2 The Chinese Remainder Theorem

For the purposes of generalizing Gethner's proof about prime- free neighbor- hoods surrounding a Gaussian prime, we will need to reference the Chinese

Remainder Theorem parenthesis C R T parenthesis . We first recall the classical version of this result.

Theorem 2 point 2 point 1 parenthesis Chinese Remainder Theorem for integer number set symbol parenthesis If positive integers n sub 1 comma dot dot dot comma n sub kar e pairwise relatively prime, then for any integers a sub 1 comma dot dot dot comma a sub k there exists a unique integer solution x modulo n sub 1 n sub 2 dot dot dot n sub k to thefollowin g system of simultaneous congruences x equivalence symbol a sub 1mo d n sub 1 comma x equivalence symbol a sub 2mo d n sub 2, dot dot dot

comma x equivalence symbol a sub kmo d n sub k.

This result can be stated more formally in Ring Theory as integer numbers set symbol symbol parenthesis n sub 1 dot dot

dot n sub k parenthesis isomorphic symbol integer numbers set symbol quotient ring symbol n sub 1

integer numbers set symbol times integer numbers set symbol quotient ring symbol n sub 2 integer numbers set symbol times dot dot dot

integer numbers set symbol quotient ring symbol n sub k integer numbers set symbol. We will find it convenient to use analogues of the

C R T for rings. From Commutative Ring Theory we have these results. Theorem 2 point 2 point 2 parenthesis

General Chinese Remainder Theorem parenthesisLe t A sub 1, A sub 2, dot dot dot, A sub k be ideals in the commutative ring R with

1 does not equal0 . Then, we have a ring homomorphism phi R right arrow R quotient ring symbol A sub 1 x R quotient ring

12 symbol A sub 2 x dot dot dot x R quotient ring symbol A sub k defined by phi parenthesis r parenthesis equals parenthesis r plus A sub 1 comma r plus A sub 2 comma dot dot dot comma r plus A sub k parenthesiswhos e kernel is A sub

1 intersection set theory symbol A sub 2 intersection set theory symbol dot dot dot intersection set theory symbol A sub k.. If for each distinct i, j set membership symbol curly brace 1 comma 2, dot dot

dot, k curly brace, A sub i intersection set theory symbol A sub j equals curly brace 0 curly brace parenthesis A sub i and A sub jar e comaximal parenthesis , then phi is surjective and A sub 1

intersection set theory symbol A sub 2 intersection set theory symbol dot dot dot set theory symbol A sub k equals A sub 1 A sub 2 dot dot dot A sub k. Consequently, R quotient ring

symbol parenthesis A sub 1 A sub 2 dot dot dot A sub k parenthesis isomorphic symbol R quotient ring symbol A sub 1 x R A sub 2 x dot dot dot x R quotient ring symbol

A sub k comma [2, p.265]. For algebraic number rings, this result is restated more simply as follows. Corollary 2 point 2 point 3 Let P sub 1 comma P sub 2 comma dot dot dot P

sub n be pairwise relatively prime ideals in a O in an algebraic K. Then, O quotient ring symbol parenthesis P sub 1 comma P sub 2 dot dot dot P sub n parenthesis

isomorphic symbol O quotient ring symbol P sub 1 x O isomorphic symbol P sub 2 x dot dot dot x O isomorphic symbol P sub n.

2 point 3 Gaussian Moats parenthesis Gethner parenthesis

The expression "Gaussian Moat" refers to a prime- free swath encircling the

origin of the complex plane. It is analogous to a moat that encircles a castle.

A k- width Gaussian moat refers to the boundary surrounding the graph that

starts at the origin of the complex plane and connects all Gaussian primes

within the connection distance k of each other.

Two papers by Ellen Gethner provide significant insight into the Gaussian

Moat problem. In "Periodic Gaussian Moats" by Gethner and Stark, [3] the

13 problem is attacked by the construction of a periodic tiling in the complex plane. A square is defined with corners at the origin, 65 plus 65 i, 130 and 65 minus

65 i. The size of this square was chosen because 65 plus 65 i has the following distinct factors of small magnitude: 1 plus 2 i, 1 minus 2 i, 3 plus 2 i, 3 minus 2 i, and 1 plus i. This allows many composite Gaussian integers inside the square to be sieved. The points remaining are relatively prime to 65 plus 65 i and colored red. These points are then connected by lines if the distance between them is at most . This network of lines forms boundaries, with the bounded region containing the point 2 plus 2 i colored blue. The blue region forms a prime- free submoat within the maximal square root of 2- moat (see Figure 2 point 1). Because of the manner in which this

Figure shows picture of tiling

Figure 2 point 1: Gethner and Stark's square root of 2 -periodic tiling. [3]

square was constructed, it is periodic and can be shifted along any of its edges by the width of the square resulting in an infinite tiling of the complex plane

14 with the blue submoat. Any walk of step size at most square root of 2 is therefore finite.

Gethner and Stark also constructed a similar tiling for a moat of at most 2.

In a second paper "A Stroll Through the Gaussian Primes", Gethner, in

conjunction with Wagon and Wick, undertake a computational attack on the

Gaussian Moat problem, proving that moats of at most square root of 26 exist. The follow-

ing remarks are from Gethner.

Remark 2 point 3 point 1 It is only necessary to connect primes in the first octant, as the

elements in the remaining 7 octants are all associates or conjugates of the Gaus-

sian integers in the first octant. The first octant is the sector where parenthesis 0 degrees less than equal to theta less than 45 degrees parenthesis. The remaining 7 octants are defined in increments of every 45 degrees thereafter.

Remark 2 point 3 point 2 Any edge parenthesis a comma b parenthesis used to connect Gaussian primes, with the excep-

tion of parenthesis 1 comma 0 parenthesis,mus t be comprised of integers a and b which are both odd or both

even. The first few are parenthesis 1 comma 1 parenthesis, parenthesis 2 comma 0 parenthesis , parenthesis 2 comma 2 parenthesis , parenthesis 3 comma 1 parenthesis, parenthesis 4 comma 0

parenthesis, parenthesis 3 comma 3 parenthesis, parenthesis 4 comma 2 parenthesis, parenthesis 5 comma 1 parenthesis, parenthesis 4 comma 4 parenthesis, and parenthesis 5 comma 3

parenthesis. These edges correspond to the distances square root of 2, square root of 4, square root of 8, square root of 10, square root of 16, square root of 18,

square root of 20, square root of 26, square root of 32, and square root of3 4 respectively (due to the parity of Gaussian primes).

For distances k less than equal to square root of 18, Gethner describes the entire connected compo-

nent for each distance. For k equals square root of 20, she defined the maximum reachable distance by tracing "around the border of the component until it was completely

15 surrounded". The maximum reachable distance results were improved later by Tsuchimura. Gethner bounded the square root of2 6 -moat by connecting all Gaussian primes having a real part of 4,000,000 with any Gaussian prime of larger mag- nitude having real part of at least 4,000,000. All these connections eventually terminate, implying a moat exists in the first octant, but not necessarily the moat that defines the perimeter of the square root of 26 -connected component.

As noted in the introduction, there exists arbitrarily large prime-free gaps of integer size k on the real number line. The Gaussian Moat problem, while interesting and unsolved, is not the correct two- dimensional analogy. It is bet- ter to ask whether prime free-regions of arbitrary radius k exist in the complex plane. The answer is yes, and Gethner proves the following theorem that we discuss later in chapter 4.

Theorem 2 point 3 point 3 Let L be a line that contains at least two distinct Gaussian in- tegers, and let k be a positive integer. There is a Gaussian integer z on this line such that all Gaussian integers within a distance k of z are composite, [4, p. 332].

16 2 point 4 Gaussian Prime Density parenthesis Vardi parenthesis

The following is a summary of Vardi's derivation for the Gaussian prime den- sity density, provided in his paper "Prime Percolation", [10].

Let pi sub 1 parenthesis x parenthesis be the number of rational primes parenthesis on the real line parenthesis of the form

4 k plus 1 that are less than or equal to x. Let pi sub 3 parenthesis x parenthesis be the number of Gaussian primes with norms of the form 4 k plus 3 that are less than or equal to x. We also note the special prime 1 plus i, which is an exception to the categorization mentioned above.

Since any given Gaussian integer has 4 associates, we conclude by the

Prime Number Theorem [8, p. 86] that the number of Gaussian primes in a cir- cle centered at the origin of radius x is 8 pi sub 1 parenthesis x squared parenthesis plus 4 pi sub 2 parenthesis x parenthesis plus4 .

Then, by Dirichlet's theorem of primes in arithmetic progressions, this is asymptotic to 8 x squared divided by 2 l n x squared plus 4 x divided by 2 l n x parenthesis since pi sub 1 parenthesis x parenthesis pi sub 3 parenthesis x parenthesis tilde x divided by 2 l n x square bracket 6, p. 251 square bracket parenthesis tilde 2 x squared divided by l n x plus 2 x divided by l n x tilde 2 x squared divided by l n x.

Remark 2 point 4 point 1 The number of Gaussian integers inside a circle of radius x is asymptotic to pi x squared, we conclude that the density of the Gaussian primes is asymp- totic to 2 divided by pi l n x square bracket 10, p. 278 square bracket.

17 2 point 5 Estimating Bounds on Gaussian Moats (Vardi)

In "Prime Percolation" square bracket 10 square bracket , Vardi makes a probabilistic argument regarding

the Gaussian primes. If we assume these primes were randomly distributed

on the complex plane, then Percolation Theory predicts that for a sufficiently

small density of random Gaussian primes, a walk of bounded step size will

always be terminated by a moat surrounding the origin. Vardi provided an

estimate for the distance of the furthest point from the origin of a k- connected

Gaussian prime component, which we will use in our calculations.

Theorem 2 point 5 point 1 Given z set membership symbol integer numbers set symbol square bracket i square bracket , then k equals

square root of 2 pi lambda sub c l n vertical bar z vertical bar. Where k is the step size in

a k- connected component. The constant in continuum percolation is lambda sub c approximately equal 0 point 35.

This is the critical value where continuous percolation occurs. Remark 2 point 5 point 2 Using Theorem 2 point 5 point1 , solving for the

maximum reachable distance yields l n vertical bar z vertical bar equals k squared

divided by 2 pi lambda sub c. The exposition that follows focuses specifically on explaining the above theorem.

These insights will later be used to adapt our estimation method for bounds on the Eisenstein prime moats.

Letting X be a random variable for a Poisson distribution with parameter theta, then P parenthesis X equals n parenthesis equals theta superscript n e superscript negative theta divided by n

excalmation mark where n equals 0 comma18 1 comma 2, dot dot dotMoreover , if X is a random variable for a Binomial distribution where n represents the number of trials, p is the probability of a successful trial and q is the probability of failure parenthesis 1 minus p parenthesis, then P parenthesis X equals k parenthesis equals parenthesis n over k parenthesis p superscript k q superscript n minus k,

where k equals 0 comma 1 comma2 , dot dot dot, n minus 1. Noting that the mean for a Binomial Distribution is n p, we find that Bin parenthesis n, p parenthesis right arrow Poi parenthesis theta parenthesis

as n right arrow infinity symbol.

Vardi relies on this relationship between the Binomial and Poisson distribu- tions in his paper without making specific reference to it.

For estimation purposes, Vardi assumes the Gaussian primes are distributed randomly with a Binomial distribution. Letting z denote a Gaussian integer with sufficiently large norm, we define the Binomial parameter p equals 2 divided by pi l n vertical bar z vertical bar, the

Gaussian prime probability at z. The Binomial parameter n is the number of

Gaussian integer points inside a circle with radius vertical bar z vertical barcentere d at the origin. By Gauss' Circle

problem, it is known that n tilde pi vertical bar z vertical bar squared. In other words, if k denotes the number of Gaussian

primes in the circle vertical bar z vertical bar equalsk , then P parenthesis X equals k parenthesis equals parenthesis n over k

parenthesis 2 divided by pi l n vertical bar z vertical bar parenthesis superscript k parenthesis 1 minus 2 divided by pi l n

vertical bar z vertical bar parenthesis superscript n minus k.

In his paper, Vardi refers to the "Poisson Blob" model, which is essentially a

Poisson process of "intensity" lambda on the plane. That is, countably many points are uniformly distributed in the plane with

an area density of lambda. In his derivation for estimating the bound of the k- connected component,

19 where a is the area of a circle, then a lambdarepresent s the mean of the Binomial distribution. Vardi [10, p. 280] states that "...the probability of n centers appearing in area a is e superscript negative a lambda

parenthesis a lambda parenthesis superscript n divided by n exclamation mark. " This is clearly an implementation of the Poisson distribution.

The Poisson parameter a lambdacome s from the Binomial distribution by fixing vertical bar z vertical bar large and letting a equals n,

and lambda equals p. The relevant relationship between the two distributions is that we will use the Gaussian prime density

in the Binomial Distribution in order to arrive at the Poisson blob intensity used in the relevant Percolation Theory estimate.

Later in the derivation of his estimate, Vardi defined the scaling function f sub s parenthesis z parenthesis equals z divided by s square root

of l n vertical bar z vertical bar which approximately rescales the radius by a factor of 1 divided by s square root of l n vertical bar z

vertical bar ; in effect f sub smap s a circle centered at z with a radius of s square root of l n vertical bar z vertical

bar into a circle with radius 1 centered at z. Therefore, we can say that f sub s "rescales" the area by

parenthesis 1 divided by s square root of l n vertical bar z vertical bar parenthesis squared. Recall that the Gaussian prime

probability based on a given unit of "area" is: 2 divided by pi l n vertical bar z vertical bar. If we apply this scaling

function to this "area" we get 2 divided by pi l n vertical bar z vertical bar superscript f sub s above right arrow

2 divided by pi l n vertical bar z vertical bar divided by parenthesis 1 divided by s square root of l n vertical bar z vertical bar squared

equals 2 s squared divided by pi equals lambda, which is the intensity of the Poisson blob.

Since continuum percolation occurs at lambda equals lambda sub c this implies that 2 s sub c superscript 2 equals lambda sub c

or s sub c equals square root of pi lambda sub c divided by 2.Percolatio n Theory states that for an infinitely connected component

k divided by 2 greater than square root of pi lambda sub c divided by 2.

20 Recall our step size from the rescaling fuction is k square root of l n vertical bar z vertical bar, this implies a critical step size for the Gaussian primes of k equals square root of 2 pi lambda sub c l n vertical bar z vertical bar. Chapter 3

COMPUTATIONAL BACKGROUND

3 point 1 Improved Computational Results

(Tsuchimura)

In 20 0 4 Tsuchimura published "Computational Results for Gaussian Moat Prob- lem" [9], where he utilized an algorithm which he described as a sequential subgraph construction. By sequentially generating primes and then decom- posing them into the sum of two squares, Tsuchimura assured that every new

Gaussian prime added to the connected component is of maximum norm and is in fact a unique root of the constructed directed tree. Other directed trees that do not connect back to the origin are also maintained in memory. The

21 unique roots of all these directed trees are represented by an array of point- ers. One advantage of this method is that only the pointers within a band of width equal to the current step size must be held in memory. Tsuchimura also utilized a hash table that uses a key based on the imaginary part of a Gaus- sian integer. He claimed a 10 -fold increase in efficiency over the breadth first search method used previously by Gethner. By combining his algorithm with

38 C P Us, he provided both the specific size and farthest distance reached of

Gaussian prime connected components for step sizes up to square root of3 2 and bounded the connected components with step sizes of square root of 34 and square root of 36.

Although computational results obtained by Tsuchimura are significant, far more interesting are his improvements of Vardi's method for estimating the farthest distance reached for a connected component of step size k. He notes, "Vardi's estimate captured the essential nature of the Gaussian moat problem on the basis of percolation theory that puts on random- ness and continuity. Our contribution here is a modification, or a calibration, of Vardi's estimate with considerations of discreteness", [9, p. 13] This is an un- derstatement, as the graph of Tsuchimura's estimated distances correlates in- credibly well with the actual data.

22 Remark 3 point 1 point 1 Tsuchimura noted that some distances such square root of 2 could only be achieved with one ordered pair (1, 1). While other distances such as square root of 50 had more than one possible ordered pair, namely (1, 7), (7, 1), and (5, 5). See Figure

3 point 1.

Figure 3 point 1: Tsuchimura's observation of possible edges p parenthesis k parenthesis, radius square root of k.

When more bridges (or edges) are available for a given discrete radius k, the more likely the component can continue to be connected. Tsuchimura's graph

23 of k squared versus the farthest point reached is shown directly next to his graph of k squared versus the number of possible edges p parenthesis k parenthesis. The similarity is remarkable as demonstrated in Figure 3 point 2. Tsuchimura decided a better estimate could

Figure shows two graphs. The first graph shows farthest distance reached. The second graph shows number of possible edges.

Figure 3 point 2: Correlation between graphs observed by Tsuchimura, [9, p.11 to 12].

be made for the farthest k- connected Gaussian prime by correlating to the value p parenthesis k parenthesisinstea d of k squared. From Theorem 2 point 5 point 1 we know k equals square root of 2

pi lambda sub c l n vertical bar z vertical bar and observing that p parenthesis k parenthesis tilde pi k squared divided by 8, we conclude by stating his estimate. Theorem 3 point 1 point 2 l n vertical bar z vertical bar equals k squared divided by 2 pi lambda sub c equals 4 p parenthesis k parenthesis divided by pi squared lambda sub c approximately equal to 1 point 158 p parentheis k parenthesis. Note lambda sub c approximately equal to 0 point 35.

We used MAPLE to duplicate Tsuchimura's graph of possible edges p parenthesis k parenthesis versus the farthest distance

reached for a given k. In Figure 3 point 3 we graphed the theoretical relationship of l n vertical bar z vertical bar approximately

equal to 1 point 158 p parenthesis k parenthesis to show the high degree of correlation. See Figure 3 point3 .

24 Graph shows farthest distance and possible edges.

Figure 3 point3 : Correlation of p parenthesis k parenthesis versus zeta parenthesis k parenthesis and the estimate l n vertical bar z vertical bar approximately equal to 1 point 158 p parenthesis k parenthesis.

3 point 2 Depth -first Search Algorithm

For our computational exploration of the Gaussian and Eisenstein k- connected components, we developed a graph connecting algorithm that is based on a technique known as "Depth -first Search".

In Introduction to Algorithms [1, p. 540], Cormen, Leiserson, Rivest, and

Stein describe this algorithm as follows. "The strategy followed by depth -first search is, as its name implies, to search 'deeper' in the graph whenever possi- ble. In depth- first search, edges are explored out of the most recently discov- ered vertex v that still has unexplored edges leaving it. When all of v's edges have been explored, the search 'backtracks' to explore edges leaving the vertex from which v was discovered. This process continues until we have discovered

25 all the vertices that are reachable from the original source vertex. If any undiscovered vertices remain, then one of them is selected as a new source and the search is repeated from that source. This entire process is repeated until all vertices are discovered." The computational running time of a depth- first search is noted to be theta parenthesis V plus E parenthesis, where V is the set of all vertices within the graph and E is the set of all edges connecting those vertices. This is consistent with the algorithm we developed based on this technique.

3 point 3 Multiple Precision Integers and Rationals

Library

Most programming until recently only allowed unsigned integer type variables to store up to values of 2 superscript 32 equals 4,294,967,296 which is 32 bits.

With the advent of 64 bit operating systems, it is now possible to store val- ues up to 2 superscript 64 equals 18,446,744,073,709,551,616. For most of our work, this range is sufficient. However, to allow for the contingency of larger integer values, it would be prudent to remove this limitation. Additionally we needed a ro- bust and proven primality testing procedure. Note that a widely used C library for this purpose is the G N U Multiple Precision Arithmetic Library (G M P), that

26 unfortunately does not support Microsoft C implementations such as Visual

Studio for C. However, Multiple Precision Integers and Rationals (M P I R) is an open-source software multiprecision integer library that has as one of its spe- cific goals listed on the M P I R website (m p i r dot org), "Support for building M P I R using Microsoft Visual Studio 20 10 for use in both 32 -bit and 64 -bit versions of

Windows." Our programs developed for exploring the Eisenstein moats were written using Microsoft Visual Studio 20 13 with support for 64 -bit memory addressing. The primality testing algorithm we used was an M P I R implemen- tation of the Miller-Rabin probabilistic primality test explained in the next section.

3 point 4 Miller- Rabin Primality Testing

The Miller- Rabin primality test is the algorithm frequently implemented for primality testing in many programming languages. Although it is probabilis- tic, it can guarantee that for i iterations of this test there is less than a 4 superscript negative i chance of a falsely being declared prime. Known results have so far shown an even lower likelihood. We explain the basics following

Diane Hofoss' "The Rabin -Miller Primality Test", [5].

27 Theorem 3 point 4 point 1 Fermat's Little Theorem If n is prime and parenthesis a comma n parenthesis equals1 , then a superscript n minus 1 equivalence symbol 1 parenthesis mod n parenthesis .

Remark 3 point 4 point 2 We will use the contrapositive of Fermat's Little Theorem; namely if a superscript n minus 1 not equivalent symbol 1 parenthesis mod n parenthesis and parenthesis a comma n parenthesis equals1 , then n is composite.

If the converse of Remark 3 point 4 point 2 were true, we would have a deterministic primality test. Unfortunately this is not the case, because there exist compos- ite numbers n such that a superscript n minus 1 equivalence symbol 1 parenthesis mod n parenthesis for every base a. These numbers, which are called Carmichael numbers, are rare with only seven occurring un- der 10,000. In fact, for integers less than 10 superscript 17, the probability of an odd inte- ger being a is about one in one hundred billion. For very large numbers, Fermat's Little Theorem can be used to find "highly probable" primes.

However, the Euler test is an improvement of Fermat's Little Theorem for probabilistic primality testing. Since using this test, occur at about half the frequency.

The Euler test is based on the observation that when n is prime, an in- teger can have at most two square roots modulo n. In particular, the only square roots of 1 parenthesis mod n parenthesis are plus minus1 . This leads to the following statement: If

28 a not equivalent symbol 0 parenthesis mod n parenthesis , then a superscript parenthesis n minus 1 parenthesis divided by 2 is a square

root of a superscript n minus 1 equivalence symbol 1 parenthesis mod n parenthesis , and so a superscript parenthesis n minus 1 parenthesis divided by 2 equivalence symbol plus minus 1 parenthesis mod n parenthesis. This provides the following test for whether an inte- ger is composite: If a superscript parenthesis n minus 1 parenthesis divided by 2 not equivalent symbol plus minus 1 parenthesis mod n parenthesis for some a not equivalent symbol 0 parenthesis mod n parenthesis , then n is composite.

The limitation of the Euler test is that it does not consider square roots of

1 different from plus minus 1. The Miller- Rabin test remedies this. Using Fermat's Last

Theorem and assuming that n is odd, we can write n minus 1 equals 2 superscript s dot m, with s greater than equal to 1 and m is odd. If n is an odd prime, then either a superscript m equivalence symbol 1 parenthesis mod n parenthesis or a superscript 2

superscript r dot m equivalence symbol negative 1 parenthesis mod n parenthesis for some integer r such that 0 less than equal to r less

than equal to s minus 1. If we repeatedly take square roots of a superscript n minus 1, we will eventually get either 1 or negative1 , which is

guaranteed to satisfy either the first or second congruence above. The pseudocode for the Miller -Rabin Test is summarized as follows:

Input an odd integer n.

Let n equals 2 superscript s dot m with m odd.

Choose a random a such that 1 less than equal to a less than equal to n minus 1.

If a superscript m equivalence symbol 1 parenthesis mod n parenthesis or a superscript 2 superscript r dot m equivalence symbol

negative 1 parenthesis mod n parenthesis for some integer r such that 0 less than equal to r less than equal to s minus1 , then n is a

. Note n is a prime if all values for a are tested. One of the main advantages of the Miller -Rabin test is that pseudoprimes occur far less frequently than the theoretical expectation of 4 superscript negative i (i refers to the iterative number of random values of base a that are tested before declar- ing the value n a likely prime). More significantly, testing all values of base a makes the Miller -Rabin test deterministic. In other words, unlike the Fermat and Euler primality tests, absolute pseudoprimes do not exist for the Miller

Rabin test. In practice, it does not warrant exhaustively testing all values of base a, as the possibility of n being falsely declared composite is exceedingly low after only about 10 iterations using random base values of a. In fact, it has been confirmed that for values of n less than 341,550,071,728,321, it is sufficient to test a equals 2,3,5,7,11,13,17. See [13].

30 Chapter 4

MATHEMATICAL RESULTS

4 point 1 Annular Moats

In the introduction of this paper, we demonstrated it is possible to construct any arbitrarily large sequence of consecutive integers that are prime-free. Given that the norm is used to test for the primality of Gaussian integers, and that the norm is used for calculating the distance of Gaussian integer from the origin of the complex plane, then why not construct an arbitrarily large sequence of Gaussian norms that are composite to insure we have a prime-free circu- lar moat in the complex plane? This type of prime-free construction requires norms with an order of magnitude greater than n exclamation mark for a prime -free of size n. Unfortunately, using n consecutive norms is nowhere close to the

31 number of norms required to build any positive integer size moat a distance of square root of parenthesis n exclamation mark parenthesis from the origin. More formally, an annular moat would have

two circular boundaries. Example 4 point 1 point 1 Let the large bounding circle have a radius of square root of parenthesis

n plus 1 parenthesis exclamation mark plus parenthesis n plus 1 parenthesis, and let the small bounding circle have a

radius of square root of parenthesis n plus 1 parenthesis exclamation mark plus2 . Observe that since square root of parenthesis

n plus 1 parenthesis exclamation mark plus 2 square root of parenthesis n plus 1 parenthesis exclamation mark plus 1 minus square root of parenthesis n plus 1 parenthesis exclamation mark equals 1, we have square root of parenthesis n plus 1 parenthesis exclamation mark plus 2 square root of parenthesis n plus 1 parenthesis exclamation mark plus 1 minus square root of parenthesis n plus 1 parenthesis exclamation mark plus 2 less than1 .

Since parenthesis n plus 1 parenthesis less than 2 square root of parenthesis n plus 1 parenthesis exclamation mark plus 1 for all n greater than0 , by substitution we have square root of parenthesis n plus 1 parenthesis exclamation mark plus parenthesis n plus 1 parenthesis minus square root of parenthesis n plus 1 parenthesis exclamation mark plus 2 less than 1. Remark 4 point 1 point 2 Unfortunately we can not use this construction of an arbitrarily large sequence of composites in the rational integers to construct an arbitrarily wide circular moat in the Gaussian integers. It may be worth farther investigation to see if a lower bound for the starting point of an arbitrarily wide moat can be determined such that circular moats could be proven not to exist. Gethner speculates about this in [4].

Her insight is from the well known conjecture that lim sub n right arrow plus infinity symbol parenthesis square root of P sub n plus 1 minus square root of P sub n parenthesis equals 0, where P sub n denotes the nth prime. "If the conjecture is true, then

the circles upon which the G- primes lie become more crowded as one travels farther away from the origin in the complex 32 plane. Thus there would be no chance of finding a truly annular moat parenthesis i. e., a moat that is the region between two circles parenthesis of composite Gaussian integers", [4, p. 329].

4 point 2 Eisenstein Prime Density

In this section we provide a derivation for the density of the primes in the

Eisenstein integers. We follow the similar methodology used by Vardi in his derivation of the density of Gaussian primes. Let pi sub 1 parenthesis x parenthesis be the number of rational primes

on the real line of the form 3 k plus 1 that are less than or equal to x. Let pi sub 2 parenthesis x parenthesis be the number of

rational primes of the form 3 k plus 2 that are less than or equal to x. We also note the special prime 1 minus omegawhic h has norm 3. We prove the following result.

Theorem 4 point 2 point 1 The number of Eisenstein primes in a circle centered at the origin of radius x is asymptotic to 3 x squared divided by l n x.

Proof: Since any Eisenstein integer has 6 associates, the number of Eisenstein primes with norm less than or equal to x equals 12 pi sub 1 parenthesis x squared parenthesis plus 6 pi sub 2 parenthesis x parenthesis plus 6. Then, by Dirichlet's Theorem of primes in arithmetic progressions, this is asymptotic to

12 x squared divided by 2 l n x squared plus 6 x divided by 2 l n x parenthesis since pi sub 1 parenthesis x parenthesis tilde pi sub 2 parenthesis x parenthesis tilde x divided by 2 l n x, [6, p. 251]

33 tilde 3 x squared divided by l n x plus 3 x divided by l n x tilde 3 x squared divided by l n x.

The Eisenstein integers are the uniformly distributed points of a triangular lattice made up of equilateral triangles with sides equal to 1. For every lattice point, there is a one to one correspondence with a parallelogram made from two of the equilateral triangles in the lattice. Since there is one lattice point per parallelogram of area divided by 2, the density of the Eisenstein integers is 2 divided by

square root of 3 per unit area. Therefore the number of Eisenstein integers inside a circle of radius x is asymptotic to 2 divided by square root of 3 pi x squared. From this, we conclude the following.

Corollary 4 point 2 point 2 The density of the Eisenstein primes is asymptotic to parenthesis 3 x squared divided by l n x parenthesis divided by parenthesis 2 divided by square root of 3 pi x squared parenthesis equals 3 square root of 3 divided

by 2 pi l n x. A more formal derivation of the density is as follows. As stated in Definition 2 point 1 point 6 the norm

for an Eisenstein integer is N parenthesis a plus b omega parenthesis equals a squared minus a b plus b squared equals n. We can say the number of Eisenstein integers with N parenthesis a plus b omega parenthesis less than equal to n is asymptotic to the area enclosed by the ellipse a squared minus a b plus b squared equals parenthesis

a minus b divided by 2 parenthesis squared plus parenthesis square root of 3 divided by 2 parenthesis squared

equals n. The change of variables u equals a minus b divided by 2, v equals square root of 3 divided by 2transform s the

equation of the ellipse to u squared plus v squared equals n, which encloses area pi n. Since the Jacobian of this transformation

34 delta parenthesis a comma b parenthesis divided by delta parenthesis u comma v parenthesis equals vertical bar 1 negative 1 divided by 2 0 square root of 3 divided by 2 vertical bar equals square root of 3 divided by 2, the area of this ellipse is double integral symbol 1 vertical bar delta parenthesis u comma v parenthesis divided by delta parenthesis a comma b parenthesis d u d v equals 2 pi n divided by square root of 3.

We conclude as in Corollary 4 point 2 point 2 that the density of the Eisenstein primes is 3 square root of 3 divided by 2 pi l n x.

4 point 3 Finding p parenthesis k parenthesis for a k- connected Eisenstein Prime Component

When connecting Gaussian primes, we concluded that p parenthesis k parenthesis tilde pi k squared divided by 8; so it seemed logical to assume p parenthesis k parenthesis tilde pi k squared divided by 12, since unique Eisenstein integers occupy only a

30 degree sector centered at the origin. However some hidden subtleties exist in the differences between the square lattice of Gaussian

integers and the triangular lattice of Eisenstein integers. Taking a closer look at p parenthesis k parenthesis for the Eisenstein integers' we

observe that if we start at the origin and add Eisenstein integers in order of magnitude' we see that the come in increments of either 6 or 12 Eisenstein integers at a time.

Eisenstein integers of equal magnitude by definition always lie on the same circle centered about the origin. These same Eisenstein integers also lie on a

35 hexagonal perimeter centered about the origin.

Therefore each of equal magnitude Eisenstein integers adds ei- ther 1 or 2 to p parenthesis k parenthesis up to six -fold symmetry. The simple reason for this is a circle and hexagon sharing the same center only intersect at 0, 1, or 2 places per hexagonal side. See Figure 4 point1 .

Figure 4 point1 : Hexagonal growth of the Eisenstein integers.

If we isolate a 60 degree sector with its vertex centered at the origin, it can easily be seen that the number of triangular lattice points within that sec- tor increase by positive integer increments parenthesis 1,2,3,4 dot dot dot parenthesis . This means that the

36 number of lattice points in a sector can be found by using the well -known summation for consecutive integers from 1 to k, which is k parenthesis k plus 1 parenthesis divided by 2.

Remark 4 point 3 point 1 We observe that for hexagons with integer length sides centered about the origin, the total non -zero points within and including the perimeter can be calculated as follows: h parenthesis k parenthesis equals 3 parenthesis k squared plus k parenthesis and that p parenthesis

k parenthesis equals h parenthesis k parenthesis divided by 6. This calculation yields the exact value for p parenthesis k parenthesis

when k set membership symbol integer numbers set symbol. Therefore, we conclude that p parenthesis k parenthesis tilde k squared divided by 2 for all values of k.

4 point 4 Estimating Methods for Bounding Eisenstein

Moats

In a manner similar to Vardi, we provide an estimate for the farthest distance reached in a k -connected Eisenstein prime component, stated as follows.

Theorem 4 point 4 point 1 Given z set membership symbol integer numbers set symbol vertical bar omega vertical bar, then k equals square root of 8 pi lambda sub c l n vertical bar z vertical bar divided by 3 square root of 3. Where k is the step size in a k- connected component. The constant in continuum percolation is lambda sub c approximately equal to 0 point 35.

Remark 4 point 4 point 2 Using Theorem 4 point 4 point 1, solving for the maximum reachable distance yields l n vertical bar z vertical bar equals 3 square root of 3 k squared divided by 8 pi lambda sub c.

37 We obtain this result by first calculating the intensity lambda of the Poisson blob.

For the Eisenstein primes, we define the scaling function f sub s parenthesis z parenthesis equals z divided by s square root of l n

vertical bar z vertical bar which rescales the radius by a factor of 1 divided by s square root of l n vertical bar z vertical bar; in effect

f sub smap s a circle centered at z with a radius of s square root of l n vertical bar z vertical bar into a circle with radius 1 centered at z.

Therefore f sub s "rescales" the area by parenthesis 1 divided by s square root of l n vertical bar z vertical bar parenthesis squared.

Recall that the Eisenstein prime probability based on a given unit of "area" is: 3 square root of 3 divided by 2 pi l n vertical bar z

vertical bar. If we apply this scaling function to this "area" we get 3 square root of 3 divided by 2 pi l n vertical bar z vertical bar

f sub s above right arrow 3 square root of 3 divided by 2 pi l n vertical bar z vertical bar divided by parenthesis 1 divided by s square root

of l n vertical bar z vertical bar parenthesis squared equals 3 square root of 3 s squared divided by 2 pi equals lambda, which is the

intensity of the Poisson blob. Since continuum percolation occurs at lambda equals lambda sub c see Theorem 2 point 5 point 1, this

implies that 3 square root of 3 s squared divided by 2 pi equals lambda sub c or s sub c equals square root of 2 pi lambda sub c divided by 3 square root of 3. From Percolation

Theory we conclude that for an infinitely connected component k divided by 2 greater than square root of 2 pi lambda sub c divided by 3 square root of 3. Recalling our step size

parenthesis k square root of l n vertical bar z vertical bar parenthesisfro m the rescaling function, this implies a critical step size for the Eisenstein primes of k equals square

root of 8 pi lambda sub c l n vertical bar z vertical bar divided by 3 square root of 3. We now improve our estimate. Recall that Tsuchimura defined p parenthesis k parenthesis

as the number of possible edges for a given step size k. Theorem 4 point 4 point 3 From Theorem 4 point 4 point 1 we know k equals square root of 8 pi lambda sub c l n vertical

bar z vertical bar divided by 3 square root of 3 and from our observtion in Remark 4 point 3 point 1 that p parenthesis k parenthesis tilde k squared, we conclude l n vertical bar z

vertical bar equals 3 square root of 3 divided by 4 pi lambda sub c p parenthesis k parenthesis approximately equal to 1 point 181 p parenthesis k parenthesis . Note lambda sub c

approximately equal to 0 point 35.

38 Remark 4 point 4 point 4 Intuitively, it would be reasonable to expect the Eisenstein primes to form larger connected components than the Gaussian primes for a given step size k, since Eisenstein primes have a 29 point 9 percent higher density than the Gaus- sian primes. The surprising result is that the difference between the Gaussian and Eisenstein estimates for the farthest reachable point given a step size k is marginal on a logarithmic scale. The estimate for this distance z is l n vertical bar z vertical bar approximately equal to

1 point 1 5 8 p parenthesis k parenthesis for the k -connected Gaussian prime component and l n vertical bar z vertical bar approximately equal to 1 point18 1 p parenthesis k parenthesis for the k -connected Eisenstein prime component.

4 point 5 Generalizing Gethner's Proof to the Eisenstein

Integers

The following is a direct conversion of Gethner's Theorem [4, p. 332] for the

Gaussian integers to our adaptation for the Eisenstein integers. We provide an even more generalized adaptation to the imaginary quadratic integers in the appendix.

Theorem 4 point 5 point 1 Let L be a line that contains at least two distinct Eisenstein in- tegers, and let k be a positive integer. There is an Eisenstein integer w on this line such that all Eisenstein integers within a distance k of w are composite.

39 We start by proving the following lemma for the proof of our theorem.

Lemma 4 point 5 point 2 Let L be line that contains at least two distinct Eisenstein inte- gers. Then there are Eisenstein integers m does not equal 0 and b such that the real and imaginary parts of m are relatively prime and the Eisenstein integer z is on this line iff there is an x set membership symbol integer numbers set symbol such that z equals m x plusb .

Proof: Let z sub 1 and z sub 2 be two Eisenstein integers on the line L. Define b equals z sub 1, m sub 0 equals z sub 2 minus z sub 1, and d equals g c d parenthesis R e parenthesis m sub 0 parenthesis , I m parenthesis m sub 0 parenthesis parenthesis . Finally let m equals m sub 0 divided by d equals u plus v omega.I t follows that the real and imaginary parts of m are relatively prime, and every point on the line is of the form m x plus b where x is a real number.

Let z be any Eisenstein integer on L. Hence, there is a real number x such that z equals m x plus b. We need to show that x is an integer. We know that m x equals u x plus v x omega equals z minus b is an Eisenstein integer. So, we deduce that u x and v x are integers. Since u and v are relatively prime, there are integers r and s such that u r plus v s equals 1. Hence u x r plus v x s equals x is an integer. It is straightforward to see that if x is an integer, then z equals m x plus b is an Eisenstein integer.

Proof of Theorem 4 point 5 point 1: Let m and b be two Eisenstein integers that define the line L as per Lemma 4 point 5 point 2. We consider three cases. First assume that L is horizontal. Then the imaginary part of m is 0, and so we may take m equals 1,

40 because its real and imaginary parts are relatively prime. Let b sub 1 be the imag- inary part of b and let K equals vertical bar b sub 1 vertical bar plusk . Our goal is to find an integer w sub 0 with the property that each Eisenstein integer z such that vertical bar z minus w sub 0 vertical bar less than equal to K is composite.

From this, it quickly follows that if w equals w sub 0 plus b sub 1 omega, then w is on L, and if z is any

Eisenstein integer with the property that vertical bar z minus w vertical bar less than equal to k, then z is composite.

Since curly brace z set membership symbol integer numbers set symbol square bracket omega square bracket colon vertical

bar z vertical bar less than equal to K curly brace is a finite set, say with N elements, we may its elements so z subj equals u sub j equals u sub j plus v sub j omegawit h u sub j and v sub j being integers for j equals1 , dot

dot dot N. Initialize z sub 1 equals 0.

We claim there exists a system of linear congruences x equivalence symbol a sub j mod b sub j for j equals1 , dot dot dot, N

so that:

(1) The b sub j's are integers chosen to be pairwise relatively prime.

(2) Then, the a sub j's are integers chosen so that z sub j plus a sub j and b sub j are not relatively prime.

We now prove this by induction on N. For the base case N equals1 , start with a sub 1 equals 0 and b sub 1 equals 4 (recall that z sub 1 equals0) . The two conditions are satisfied. For our inductive hypothesis, suppose that a sub 1, dot dot dot, a sub j minus 1, b sub 1, dot dot dot, b sub j minus 1 have been defined.

Recall that z subj equals u sub j plus v sub j omega.Nex t we must find an integer s sub j so that s sub j plus v sub j omega has an Eisenstein prime factor p sub j with the property p sub j bar p subj is larger than the product b sub 1 b sub 2 dot dot dot b sub j minus 1.T o accomplish this, let s sub j equals v sub j M, where M is the product

41 of all Eisenstein primes q that meet the condition vertical bar q vertical bar less than equal to b sub 1 b sub 2 dot dot dot b sub j minus 1. Then we have s sub j plus v sub j omega equals v sub j parenthesis M plus omega parenthesis . We now claim the

magnitude of any prime factor of M plus omega is larger than pi superscript j minus 1 over i equals 1 b sub 1, as desired. We

prove this by contradiction. Suppose there exists an Eisenstein prime factor p of M plus omega such that vertical bar p vertical bar less than equal to pi superscript j minus 1 above i equals 1 b sub i. Then p vertical bar M, by the construction of M. So if p vertical bar parenthesis M plus omega parenthesis , then p vertical bar omega which is a contradiction since omega is a unit. Choose one such factor p subj . Now let b sub j equals p sub j bar p sub j and a sub j equals s sub j minus u sub j. Condition

1 is trivially satisfied. Condition 2 follows from the identity z subj plus a sub j equals s sub j plus v sub j omega.

This concludes the induction. The C R T guarantees an infinite set of solutions to this system of linear congruences.

Suppose w is one of these solutions and let P equals pi superscript j over i equals 1 b subi . We assume that w is larger than P plus K. Let j be one of the integers 1, dot dot dot, N. Since b sub j and z sub j plus a sub j are not relatively prime, there is an Eisenstein prime q sub j that divides them both. Since w is a solution to the system of congruences, it follows that w plus z sub j equivalence symbol a sub j mod b sub j and thus w plus z sub j equivalence symbol 0 mod q subj. Since the

magnitude of w plus z sub j is larger than P since vertical bar w plus z sub j vertical bar greater than equal to vertical bar

w vertical bar minus vertical bar z vertical bar greater than parenthesis P plus K parenthesis minus K equals P parenthesis

and because the magnitude of q sub j is less than P since q sub j is a prime factor of the composite number P, the quotient w plus z sub j divided by q sub jha s magnitude larger than 1. Hence for each j equals 1,2, dot dot dot, N, it follows that w plus z sub j is not an Eisenstein prime as required.

42 In the second case, we assume that L is vertical, then the real part of m is

0. The argument is nearly identical to that of the first case.

In the final case, assume that both the real and imaginary parts of m are nonzero. As in the first case, let z subj equals u sub j plus v sub j omega with j equals 1, dot dot dot, N indexing the

Eisenstein integers z with vertical bar z vertical bar less thank . Initialize z sub 1 equals0 .

Inductively define a system of linear congruences x equivalence symbol z sub j mod b sub j so that:

(1) The b sub j's are distinct Eisenstein primes.

(2) b sub j equals u sub j plus v sub j omega where 0 less than u sub j divided by 2 (i. e., the b sub j's are in the first 30 degree sector and are not real).

(3) m and b sub j are relatively prime.

Let b sub 1 be an Eisenstein prime that satisfies conditions (2) and (3), and let the first linear congruence be x equivalence symbol z sub 1 mod b sub 1. Then the first three condi- tions are satisfied. Suppose z sub 1, dot dot dot, z sub j minus 1, b sub 1, dot dot dot, b sub j minus 1 have been defined. Find an Eisenstein prime b sub j with the property that vertical bar b sub j vertical bar is larger than the product vertical bar m b sub 1 b sub 2 dot dot dot b sub j minus 1 vertical bar and satisfies condition (2). Condition (1) is satisfied because vertical bar b sub j vertical bar greater than vertical bar b sub i vertical bar for i equals1 , dot dot dot, j minus1 , and condition (3)

is satisfied because vertical bar b sub j vertical bar greater than vertical bar m vertical bar . This concludes the induction.

The C R T for the Eisenstein integers guarantees an infinite set of solutions to the system of linear congruences. Let w sub 0 be one of those solutions, and

43 let P equals pi superscript j over i equals 1. We claim that the real and imaginary parts of P are relatively prime. To see this, suppose p is a non trivial prime of the real and imaginary parts of P. Then p vertical bar P. Now the Eisenstein prime factorization of p is either just p parenthesis if p equivalence symbol 2 mod 3 parenthesis or parenthesis x plus omega y parenthesis parenthesis x plus omega squared y parenthesis parenthesis if p equivalence symbol 1 mod 3 parenthesis for some x comma y set membership symbol integer numbers set symbol.Howeve r the primes from this factorization should be in the list of b sub j's, a contradiction since by condition 2 each b sub j has positive imaginary part.

Also, P is relatively prime to m by condition 3. As a consequence, there

are Eisenstein integers r and s such that m r minus P s equals w sub0 minusb . Hence m r plus b equals

P s plus w sub 0. Let r equals r sub 0 plus r sub 1 omega and P equals P sub 0 plus P sub 1 omega.Sinc e P sub 0 and P sub 1 are relatively prime, there are integers

t sub 0 and t sub 1 such that P sub 0 t sub 1 plus P sub 1 t sub 0 equals r sub 1. Let t equals t sub 0 plus t sub 1 omega. It follows that for any integer n, r minus t P

minus n P bar P is an integer, and therefore w sub n equals P parenthesis s minus t m minus n m bar P parenthesis plus w sub 0 equals m parenthesis r minus t P minus n P

bar P parenthesis plus b is a point on the line L. Choose n so that vertical bar w sub n vertical bar greater than vertical bar P vertical bar plus k to ensure that vertical bar

w sub n plus z sub j vertical bar greater than vertical bar P vertical bar because vertical bar w sub n plus z sub j vertical bar greater than equal to vertical bar w sub n

vertical bar minus vertical bar z subj vertical bar greater than parenthesis vertical bar P vertical bar plus k parenthesis minus k equals vertical bar P vertical bar

parenthesis . Note also that w sub n equivalence symbol w sub 0 mod P. Thus w sub n plus z subj equivalence symbol w sub 0 plus z sub j mod b sub j for each j equals 1,

dot dot dot, N and hence parenthesis w sub n plus z subj parenthesis divided by b sub j is an Eisenstein integer.

Moreover, since b sub j is a divisor of P the magnitude of parenthesis w sub n plus z sub j parenthesis divided by b sub j is larger than

1. It follows that w sub n plus z subj is composite for each j equals 1, dot dot dot,N . This concludes the final case.

44 Chapter 5

Computational Results

5 point 1 Overview of Approach

Our primary goal was to undertake a computational exploration of the Eisen- stein moats and to find an estimate for the farthest point reached for k- connected components of Eisenstein primes by adapting methods developed by Vardi and Tsuchimura for estimating the farthest point reached in a k- connected

Gaussian prime component.

We developed a program in Microsoft Visual Studio for C to confirm Tsuchimura's results up to a Gaussian moat width of square root of 20. The advantage of doing this was two -fold. First, it would provide an independent confirmation of his results.

Secondly if we confirmed his results, it would give us a high confidence level

45 in the graph connecting algorithm we developed. The same algorithm could easily be used for finding the k -connected components of Eisenstein primes by making simple edits that only involved changing the method in which the norm is calculated for Eisenstein integers.

5 point 2 k -Connected Gaussian Prime Algorithm

Our algorithm was designed as a variation on a common algorithm known as a Depth -First Search (see Section 3 point2) . The goals were to make maximum use of available memory, to develop a hash function for accessing the data quickly, and to minimize arithmetic operations.

In order to maximize memory, we utilize a dynamically allocated charac- ter array; hence the only limitation on our data structure was the amount of memory actually installed. By choosing a character array, each memory loca- tion only required one byte, which is the minimum addressable unit of mem- ory.

A standard rectangular array usually would be the logical choice for storing two -dimensional data. In our case, we are only storing data from the first 45 degree sector of the Gaussian integers. Although rectangular arrays are visualized

46 as rectangular data tables, programming languages in fact implement them as sequentially stored data with a hash function that takes the row and indices as input to calculate the actual one -dimensional index in the sequentially stored data. Therefore a hash function that recognizes the tri- angular structure of the data in the first 45 degree sector would immediately double the utilization of memory. Memory utilization can again be doubled by noting Gaussian primes can not appear on any of the white squares shown in Figure 5 point1 .

Figure 5 point1 : Norm equivalence symbol 1 (mod 4) for all Gaussian primes.

47 Since Gaussian primes are always 1 parenthesis mod 4 parenthesis , we only need to design a hash function that maps these squares directly to our one -dimensional se- quential dynamic array. To accomplish this, we use the following hash func- tion: h parenthesis r comma i parenthesis equals floor bracket r divided by 2 floor bracket parenthesis floor bracket r

divided by 2 floor bracket plus r parenthesis mod 2 parenthesis parenthesis plus floor bracket i divided by 2 floor bracket;

this calculates the index in our sequential dynamic array from the imaginary and real integer parts of our Gaussian integer.

We initialize the array with "x" characters. We step incrementally through the imaginary coefficients as we increment through the real coefficients. We first evaluate each Gaussian integer using the Miller-Rabin probabilistic primality test, and then check for possible con- necting primes by utilizing an indexing mask to check only the values within k distance of the subject Gaussian prime. We store "n" for not prime, "c" for connected prime and "u" for unconnected prime. For our purposes the "in- dexing mask" is a list of all the possible ordered pairs of integers that represent the possible connecting distances of at most k.

When a new prime is tagged as being connected to another connected prime, we then must check if any previously unconnected primes can now be connected to the newest node.

Because of our use of a hash function and indexing mask, we are able to limit our searches for connectivity to only the immediate two -dimensional

48 neighbors of a complex prime integer. Additionally, we do not have to calculate distance. Instead we only have to check neighboring indices for the stored value "u" or "c". For a listing of the pseudocode for the k -connected Gaussian prime algorithm see

Figure 5 point 2. Figure 5.2: Pseudocode for the k -connected Gaussian prime algorithm. Algorithm 1 Connected Component Algorithm. Require: Current complex integer node is prime and unconnected. complex Int bracket current Real comma current Imag

bracket equals quote u quote. Line 1: procedure find connections. Line 2 for i less than equal to total Mask Values do. Line 3: temp Real equals current Real plus 2 d Mask bracket i comma 0 bracket. Line 4 temp Imag equals current Imag plus 2 d Mask bracket i

comma 1 bracket. Line 5 if complex Integer bracket temp Real comma temp Imag bracket equals quote c quote then. Line 6 complex Integer bracket current Real comma current Imag bracket left arrow quote c quote. Line 7 push parenthesis stack parenthesis left

arrow complex Integer bracket current Real comma current Imag bracket. Line 8 break. Line 9 end if. Line 10 end for. Line 11 while stack not empty do. Line 12 complex Integer bracket current Real comma current Imag bracket left

arrow pop parenthesis stack parenthesis. Line 13 for i less than equal to total Mask Values do. Line 14 temp Real equals current Real plus 2 d Mask bracket i comma 0 bracket. Line 15 temp Imag equals current Imag plus 2 d Mask

bracket i comma 1 bracket. Line 16 if complex Integer bracket temp Real comma temp Imag bracket equals quote u quote then. Line 17 complex Integer bracket temp Real comma temp Imag bracket left arrow quote c quote. Line 18 push

parenthesis stack parenthesis left arrow complex Integer bracket temp Real comma temp Imag bracket. Line 19 end if. Line 20 end for. Line 21 end while. Line 22 end procedure. Our search time has a complexity of theta parenthesis V plus E parenthesis

(see Section 3 point 2) which becomes insignificant as we test larger components in comparison to the time required for primality testing which has complexity 0 parenthesis parenthesis log n parenthesis squared parenthesis [12, p. 182].

We verified this is by finding the maximum magnitude of a Gaussian integer in a given k -connected component and then test all Gaussian integers less

49 than this magnitude for primality. The time to do this was more than 90 percent of the time to do the same primality testing when combined with testing for connected values.

5 point 3 k -Connected Eisenstein Prime Algorithm.

The algorithms for connecting Eisenstein primes and connecting Gaussian primes are similar. The main difference is the use of different norms for pri- mality testing.

Another less important difference is that although we still use a dynamic character array we now have twice as many possible ordered pairs of integers that represent the possible connecting distances of at most k. Why is this?

For the Gaussian integers any edge (a commab ) used to connect Gaussian primes, with the exception of (1 comma0) , must either be comprised of integers where a and b are both odd or both even; see Remark 2 point 3 point2 . This results in a uniform checkerboard pattern where only squares that have a norm congruent to 1

(mod 4) could ever be Gaussian primes. This also allows us to skip primality testing for any Gaussian integer that is no congruent to 1 (mod 4). Unfortu- nately there is no simplistic counting pattern that can easily be built into a "for

50 loop" as a parity filter for excluding certain ordered pairs of edges in the Eisen- stein primes from consideration when testing for connectivity. In fact, all edge combinations represent possible connecting distances in an Eisenstein con- nected component. This can be seen in Figure 5 point 3 which exhaustively shows all possible combinations.

Figure 5 point3 : Distance combinations equivalent symbol 1 (mod 6) for Eisenstein prime components.

The vertical column along the left hand edge of the table above repre- sents the ordered pair [a sub 1 (mod 6), b sub 1 (mod 6)] of an Eisenstein integer a plus b omega. The horizontal row along the top of the table represents the ordered pair

[a sub 2 (mod 6), b sub 2 (mod 6)] of a possible connecting distance in the Eisenstein prime component. In both cases, values with a yellow background have a norm congruent to 1 (mod 6), a necessary condition for Eisenstein primes.

51 The values inside the table show which combinations when added yield a re- sult congruent to 1 (mod 6) which have a background color of light green.

This table shows that every ordered pair representing a connecting distance can be added to some ordered pair congruent to 1 (mod 6) with a resulting sum congruent to 1 (mod 6).

From this information, it is possible by noting the value of a (mod 6) for each Eisenstein integer a plus b omega to predict a repeating pattern for the values of b that have norm congruent to 1 (mod 6). This observation was used to cut primality testing in half. However, we did not attempt to come up with a hash function that would have recognized this pattern in order to reduce the memory requirements of our program.

Remark 5 point 3 point 1 An interesting observation came from analyzing our data and deciding how best to store it. When the Eisenstein integers with norm congru- ent to 1 (mod 6) were graphed, we observed an interesting pattern. Note in

Figure 5 point 4 how these Eisenstein integers are distributed with a regular pattern of hexagonal islands.

52 Figure 5 point 4: Eisenstein integers with N parenthesis a plus b omega parenthesis equivalence symbol 1 (mod 6).

However, this pattern does not have the same uniformity of the checker- board pattern formed by Gaussian integers that are 1 (mod 4). All Gaussian integers 1 (mod 4) can be connected with an edge (1 comma1 ) or distance of square root of 2.

Some Eisenstein integers 1 (mod 6) can be connected with a distance as small as 1, but in order to leave a hexagonal island and connect to an Eisenstein integer on a neighboring 1 (mod 6) island, a distance of at least square root of 3 is re- quired. This unique may play some role in why the farthest point reached for small k -connected Eisenstein prime components is gener- ally further than the theoretical predicted value. If the pattern of Eisenstein integers

53 which are 1 (mod 6) does somehow affect the connectivity of the small k -connected Eisenstein prime components explored so far, we believe this ef- fect may become negligible for larger values of k.

5 point 4 Gaussian Prime Viewer for Validation

Purposes

As part of our initial investigation of Gaussian Moats we developed an in- teractive Windows viewing tool for exploration of the Gaussian primes any- where in the complex plane. The purpose of this tool was not only to aid in the visualization of Gaussian primes and their density in any given area, but also to facilitate trouble shooting in the development of our prime con- necting algorithm. It was much easier to "see" the primes that needed con- necting in a given area when visually represented. The program was cre- ated by using game programming source code from Jonathan Harbour's book

Beginning Game Programming (third Edition) [7] and then combining it with the tools provided in the M P I R Library for primality testing. Although this tool was not utilized that extensively in the development of the program for find- ing k -connected Gaussian prime components, the source code is provided in

54 the appendix as it might be a useful tool for anyone doing research in the field of Computational Number Theory. Figure 5 point 5 shows the viewer centered on

Figure 5 point5 : Interactive Windows viewing tool for exploration of the Gaussian primes.

the smallest real 17 -isolated Gaussian prime identified by Gethner, [4, p. 335].

It is located at 2 0 7 8 5 2 0 7 on the real line. The small green squares in the view- ing window represent the locations of Gaussian primes. The arrow keys can be used to shift the viewing window right, left, up, or down. Our viewing pro- gram uses the M P I R library for primality testing and therefore the magnitude

55 of Gaussian primes we could display is not limited by the 64 -bit maximum im- posed on integers in most modern programming languages. In fact, we have displayed Gaussian primes where the real and imaginary parts both exceed

100 digits.

5 point 5 Validation of Gaussian Moat Data

k squaredP parenthesis Edge s Max Correct G -Prime Max Dist In parenthesis Max DCorrecte d Size parenthesis k parenthesis 2 plus 1 1 1 (0 negative 1) 2 point 236 0 point 8047 2 11 plus 4 i

2 2 (1. 1) 11 point 705 2 point 4600 14

4 3 (0, 2) 42 plus 17 i 45 point 2 310 3 point 8135 92

8 4 (2. 2) 84 plus 41 i 93 point 472 4 point 5377 380

10 6 (1. 3), (3, 1) 976 plus 311 i 1,024 point 352 6 point931 8 31,221

16 7 (0, 4) 3297 plus 2780 i 4,312 point 610 8 point 3693 347,638 18

8 (3, 3) 8174 plus 698l i 10,749 point 36 9 point 2826 2,386,129

20 10 (2, 4),(4, 2) 120510 plus 57857 i 133,679 point 1 11 point 8032 273,791,623

Figure 5 point6 : Computational Data: k -connected Gaussian prime components.

Our algorithm confirms Tsuchimura's results for both the size of the con- nected component and the farthest connected Gaussian prime for all step sizes up to k equals square root of 20. These results also validate our Gaussian prime con- necting algorithm which only required minor modifications to be used as an

Eisenstein prime connecting algorithm.

56 5 point 6 Eisenstein Moat Data

P (k) Edges Max. E- Prime Max Distance l n (Max D) E- Primes

1 1 (0,1) 5 plus 2 omega 4 point 359 1 point 4722 5

3 2 (2.1) 52 plus 7 omega 48 point 877 3 point 8893 120

4 3 (2.0) 92 plus 11 omega 87 point02 3 4 point 4662 354

7 5 (3,1),(1,3) 535 plus 49 omega 512 point 261 6 point 2388 9,685

9 6 (3,0) 2593 plus 1120 omega 2,252 point 529 7 point 7198 131,326

12 7 (4,2) 20973 plus 3518 omega 19,454 point 0 5 9 point 8758 7,541,649

13 9 (4,1), (1,4) 80976 plus282 7 omega 79,600 point 16 11 point 2848 104,339,028 16 10 (4,0) 246287 plus 118259 omega 236,793 point 6 12 point374 9 907,217,510

Figure 5 point7 : Computational Data: k- connected Eisenstein prime components.

Figure 5 point 7 shows our results for both the size of the connected component and the farthest connected Eisenstein prime for all step sizes up to k equals square root of 16.

In order to find the square root of 19-connecte d Eisenstein prime component, we would need a computer with more than 8 G B of memory or a more efficient way to store primes. This is to accommodate when our connecting algorithm needs to explore previously unconnected primes by backtracking into our data. One way we could get a 4 -fold increase out of our memory utilization would be to store data for four Eisenstein integers in a single 8 -bit character. Since we only characterize a stored Eisentein integer as untested ("x"), not prime ("n"), unconnected prime ("u"), or connected prime ("c"), we would only need 2 bits to represent each of the four possible choices.

57 Figure 5 point8 : p parenthesis k parenthesis versusFarthes t Distance for k -connected E -prime components.

In Figure 5 point8 , we use MAPLE software and our data from Figure 5 point 7 to plot the line of best fit using the least squares method. The line has a slope of 1 point 21, as compared to the our theoretical prediction of 1 point18 . Our last three values for the natural logarithm of the maximum distance reached, expressed as a multiple of p parenthesis k parenthesiswer e 1 point 411 p parenthesis k parenthesis , 1 point 253 p parenthesis k parenthesis ,

and 1 point 237 p parenthesis k parenthesis. We believe with larger values of k, the slope may approach the predicted value

1 point 18. In our conclusion, we discuss possible reasons why our actual results were slightly higher than predicted.

58 We created the following graphic shown in Figure 5 point9 . Since the Eisensteins have an inherent 12 -fold

symmetry, we only need to find the points representing the Eisenstein primes in the first 30 degree sector. The remaining

Figure 5 point 9: square root of 7 -connected Eisenstein prime component.

points can be created by reflecting that result across the x axis and then

rotating that combined result in 60 degree increments until the full graphic is

created. We now mention a useful and fun fact for doing these manipulations.

For reflecting (mirroring) an Eisenstein integer a plus b omega across the x -axis, use

M parenthesis a plus b omega parenthesis equals parenthesis a minus b parenthesis minus b omega and for rotating 60 degrees use R parenthesis a plus b omega

parenthesis equals parenthesis a minus b parenthesis plus a omega. The MAPLE code for this graphic is included in the appendix.

59 Chapter 6

Conclusion

The original goal of our research was by computational means to find the next largest Gaussian moat and then to use these computational techniques to find all the moats for the Eisenstein integers computable with a single P C using a fast C P U and a fully populated memory capacity.

Early in this exploration, we developed an interactive viewer as a tool to aid our investigation into the connectivity of Gaussian primes. Shortly there- after, our initial reading of the available sources on this topic led to the disclo- sure that a team of computational scientists in Japan, led by Tsuchimura had tackled this problem using a distributed computing approach with a hashing algorithm to extend the fully defined moats from the largest known k -width of

60 square root of 20 to k equals square root of 32. They also established initial bounds for moats that included k equals square root of 34 and k equals square root of 36. Although we had some ideas that may have allowed us to still prove the existence of the k equals square root of 40 moat, we no longer saw this as an interesting problem and felt as Gethner stated in her paper "One could surely prove that a square root of 32 moat exists ... (as Tsuchimura later did), but it hardly seems worth the effort since it appears clear from these computations that moats of any size exist", [4, p. 332]. However, Tsuchimura's work included some intrigu- ing improvements to the bounding estimates on Gaussian moats developed by Vardi.

We decided to perform the computational exercise of finding the Eisen- stein moats that could easily be calculated on a single P C and to develop bounding estimates for the Eisenstein moats in general.

Our original conjecture was that the estimation equation Tsuchimura had developed would only need to be adjusted for differences in the density be- tween Gaussian and Eisenstein primes, but our initial results were not even close to what was predicted. Subtleties in the structure of these two different types of primes play a major role in predicting the bounds on a k -connected component. The bottom line was that Gaussian primes could sometimes have more than two ways of manifesting a k -sized moat distance. For instance,

61 the Gaussians could have a moat jump of square root of 50 constructed in three differ- ent ways (up to four -fold symmetry) using the ordered pairs (7, 1), (1, 7), and

(5, 5). In fact, as you construct larger and larger moat widths, these individ- ual widths can some times be constructed with even more combinations. As shown in our results, the Eisenstein integers can never have more than two possible ways (up to six -fold symmetry) of constructing a k -sized moat jump.

Including this subtlety into our estimate resulted in a much more accurate but slightly lower estimate for the limited data we were able to computation- ally obtain.

We believe there are two reasons for this underestimation. First, our esti- mate is based on approaching a limit, and a much larger data set, while im- practical, may be necessary to see convergence to our estimate. Secondly, there is a subtle difference between the locations on the complex plane where

Eisenstein and Gaussian primes may exist. With Gaussian integers, we only have to check those with odd parity that occur uniformly throughout the com- plex plane, as shown by Figure 5 point1 . With the Eisenstein integers, we only need to check those that are on the hexagonal islands shown in the second graphic in Figure 5 point4 . These islands represent areas that would have localized higher density. This clustering of higher densities may make moat hopping more

62 advantageous when dealing with some of the smaller jump sizes. Increasing the

ability to moat hop would increase the size of our connected components for

small values of k. We believe this phenomenon may become less significant

as the size of potential moat jumps dwarfs the spacing size of this pattern.

Finally, for those wishing to find the next largest Gaussian moats, we make

the following suggestions. First, we note that majority of computation time

spent on our algorithm was in the process of primality testing. Large libraries

of primes are available up to one trillion. If these databases, which are contin-

ually being revised upward were used in place of primality testing, the time for

checking prime connectivity would drop significantly, as you would be doing

an extremely fast comparison test rather than a testing for probable primal-

ity. Unfortunately, these lists only eliminate the primality testing of Gaussian

integers less than a distance of one million from the origin. This technique

currently would only speed up the discovery of Gaussian moats up to square root of 26.

These lists are frequently updated to include higher ranges of primes. Revisit-

ing this idea in a year or two may have merit.

Another possibility is to choose a starting distance on the real number line

and then try to drive a circle of k size radius across the first octant avoiding

collisions with Gaussian primes. A greedy path-finding algorithm might

63 provide an efficient way to bound the next largest moat (k equals square root of 40), but as Gethner

stated in her paper,"...it hardly seems worth the effort".

64 Chapter 7

Appendix

7 point 1 Gethner's Proof Generalized for Imaginary

Quadratic Integers

The following is a direct conversion of Gethner's Theorem [4, p. 332] for the

Gaussian integers to our adaptation for the imaginary quadratic integers.

For the purposes of this proof we will use the following convention: Fix a square-free integer D, and let K be an imaginary whose ring of integers integers set symbol square bracket theta square bracket is a principal domain (P I D), where

65 theta equals brace square root of D if D not not equivalent to 1 parenthesis mod 4 parenthesis 1 plus square root of D divided by 2 if D equivalence symbol 1 parenthesis mod 4 parenthesis

The set of imaginary quadratic integers, denoted by integer set symbol square bracket theta square bracket,i s defined as integer set symbol square bracket theta square bracket equals curly brace a plus b theta vertical bar a comma b set membership symbol integer set symbol curly brace.

Theorem 7 point 1 point 1 Let L be a line that contains at least two distinct imaginary

quadratic integers, and let k be a positive integer. There is an imaginary quadratic

integer w on this line such that all imaginary quadratic integers within a dis-

tance k of w are composite.

We start by proving the following lemma, needed to prove our theorem.

Lemma 7 point 1 point 2 Let L be line that contains at least two distinct imaginary quadratic

integers. Then there are imaginary quadratic integers m does not equal 0 and b such that the real and imaginary parts of m are relatively prime and the imaginary quadratic

integer z is on this line if there is an x set membership symbol integer set symbolsuc h that z equals m x plus b.

Proof: Let z sub 1 and z sub 2b e two imaginary quadratic integers on the line L. Define b equals z sub 1, m sub 0 equals z sub 2 minus z sub 1, and d equals g c d

parenthesis R e parenthesis m sub 0 parenthesis, I m parenthesis m sub 0 parenthesis parenthesis . Finally let m equals m sub 0 d equals

u plus v theta. It follows that the real and imaginary parts of m are relatively prime, and every point on the line is of the form m x plus b where x is a real number.

66 Let z be any imaginary on L. Hence, there is a real num- ber x such that z equals m x plus b. We need to show that x is an integer. We know that m x equals u x plus v x theta equals z minus b is an imaginary quadratic integer. It follows that u x and

v x are integers. Since u and v are relatively prime, there are integers r and s such that u r plus v s equals1 . Hence u x r plus v x s equals x is an integer. We conclude that if x is an integer, then z equalsm x plus b is an imaginary quadratic integer.

Proof of Theorem 7 point 1 point1 : Let m and b be two imaginary quadratic integers that define the line L as per Lemma 7 point 1 point 2.

We consider three cases. First assume that L is horizontal. Then the imag- inary part of m is 0, and so we may take m equals 1, because its real and imag- inary parts are relatively prime. Let b sub 1 be the imaginary part of b and let

K equals vertical bar b sub 1 vertical bar plus k. Our goal is to find an integer w sub 0 with the property that each imaginary quadratic integer z such that vertical bar z minus w sub 0 vertical bar less than equal to K is composite. From this it quickly follows that if w equals w sub 0 plus b sub 1 theta, then w is on L, and if z is any imaginary quadratic integer with the property that vertical bar z minus w vertical bar less than equal to k, then z is composite.

Since curly brace z set membership symbol integer set symbol square bracket theta square bracket colon vertical bar

z vertical bar less than equal to K curly brace is a finite set, say with N elements, we may index its elements so z sub j equals u sub j plus v sub j theta with u sub j and v sub j being integers for j equals1 , dot dot dot, N.

Initialize z sub 1 equals 0. We claim there exists a system of linear congruences x equivalent to a sub j mod b sub j for

67 j equals1 , dot dot dot, N so that:

(1) The b sub js are integers chosen to be pairwise relatively prime.

(2) Then, the a sub js are integers chosen so that z sub j plus a sub j and b sub j are not relatively

prime.

We now prove this by induction on N. For the base case N equals1 , start with

a sub 1 equals 0 and b sub 1 equals 4 (recall that z sub 1 equals0) . The two conditions are satisfied. For our

inductive hypothesis, suppose that a sub 1, dot dot dot a sub j minus 1 comma b sub 1, dot dot dot, b sub j minus 1 have

been defined. Recall that z sub j equals u sub j plus v sub j theta. Next we must find an integer s sub j so that s sub j plus

v sub j theta has an imaginary quadratic prime factor p sub j with the property p sub j bar p subj is larger

than the product b sub 1 b sub 2 dot dot dot b sub j minus 1.T o accomplish this, let s sub j equals v sub j M, where M is

the product of all imaginary quadratic primes q that meet the condition vertical bar q vertical bar less than equal to b sub 1

b sub 2 dot dot dot b sub j minus 1.The n we have s sub j plus v sub j theta equals v sub j parenthesis M plus theta parenthesis. We now claim the magnitude of any prime factor of M plus theta is larger than pi superscript j minus 1 above i

equals 1 b sub 1, as desired. We prove this by contradiction. Suppose there exists an imaginary quadratic prime factor p

of M plus theta such that vertical bar p vertical bar less than equal to pi superscript j minus 1 above i equals 1 b sub i.The n

p vertical bar M, by the construction of M. So if p vertical bar parenthesis M plus theta parenthesis, then p vertical bar theta

which is a contradiction since theta is a unit. Choose one such factor p sub j. Now let b sub j equals p sub j bar p sub j and a

sub j equals s sub j minus u sub j. Condition (1) is trivially satisfied.

Condition (2) follows from the identity z sub j plus a sub j equals s sub j plus v sub j theta. This concludes the induction.

68 The C R T guarantees an infinite set of solutions to this system of linear con- gruences. Suppose w is one of these solutions and let P equals pi superscript j above i equals 1 b sub i. We assume that w is larger than P plusK . Let j be one of the integers 1, dot dot dot, N. Since b sub j and z subj plus a sub j are not relatively prime, there is an imaginary quadratic prime q sub j that divides them both. Since w is a solution to the system of congruences, it follows that w plus z sub j equivalent to a sub j mod b sub j and thus w plus z subj equivalent to 0 mod q sub j. Since

the magnitude of w plus z sub j is larger than P (since vertical bar w plus z sub j vertical bar greater than equal to

vertical bar w vertical bar minus vertical bar z vertical bar greater than parenthesis P plus K parenthesis minus K equals

P parenthesis and because the magnitude of q sub j is less than P (since q sub j is a prime factor of the composite number P), the quotient w plus z sub j divided by q sub jha s magnitude larger than 1. Hence, for each j equals 1, dot dot dot, N, it follows that w plus z sub j is not an imaginary quadratic prime as required.

In the second case, we assume that L is vertical, then the real part of m is 0. The argument is nearly identical to that of the

first case. In the final case, assume that both the real and imaginary parts of m are nonzero. As in the first case, let z sub j equals u sub j plus v sub j theta with j equals 1,...,N indexing the imaginary quadratic integers z with vertical bar z vertical bar less than k. Initialize z sub 1 equals0 .

Inductively define a system of linear congruences x equivalent to z sub j mod b sub j so that:

(1) The b sub js are distinct imaginary quadratic primes.

(2) b sub j equals u sub j plus v sub j theta where 0 less than v sub j (i. e., the b sub js are in the first quadrant and are

69 not real).

(3) m and b sub j are relatively prime.

Let b sub 1 be an imaginary quadratic prime that satisfies conditions (2) and

(3), and let the first linear congruence be x equivalent to z sub 1 mod b sub 1. Then the first three conditions are satisfied. Suppose z sub 1, dot dot dot, z sub j minus 1, b sub 1, dot dot dot, b sub j minus 1hav e been defined.

Find an imaginary quadratic prime b sub j with the property that vertical bar b sub j vertical bar is larger than the product vertical bar m b sub 1 b sub 2 dot dot dot b sub j minus 1 vertical bar and satisfies condition (2). Condition (1) is

satisfied because vertical bar b sub j vertical bar greater than vertical bar b sub i vertical bar for i equals 1, dot dot dot,

j minus 1, and condition (3) is satisfied because vertical bar b sub j vertical bar greater than vertical bar m vertical bar.

This concludes the induction. The C R T for the imaginary quadratic integers guarantees an infinite set of solutions to the system of linear congruences. Let w sub 0 be one of those solu- tions, and let P equals pi superscript j over i equals 1 b sub i. We claim that the real and imaginary parts of P are relatively prime. To see this, suppose p is a non -trivial prime divisor of the real and imaginary parts of P, then p vertical bar P. However the primes from this factor- ization should be in the list of b subj's , a contradiction since by condition (2) each b sub j has positive imaginary part.

Also, P is relatively prime to m by condition (3). As a consequence, there are imaginary quadratic integers r and s such that m r minus P s equals w sub 0 minus b. Hence m r plus b equals P s plus w sub 0. Let r equals r sub 0 plus r sub 1 theta and P equals P sub 0 plus P sub 1 theta.

since P sub 0 and P sub 1 are 70 relatively prime, there are integers t sub 0 and t sub 1 such that P sub 0 t sub 1 plus P sub 1 t sub 0 equals r sub 1. Let

t equals t sub 0 plus t sub 1 theta. It follows that for any integer n, r minus t P minus n P bar P is an integer, and

therefore w sub n equals P parenthesis s minus t m minus n m bar P parenthesis plus w sub 0 equals m parenthesis r minus t P minus n P bar P parenthesis plus b is

a point on the line L. Choose n so that vertical bar w sub n vertical bar greater than vertical bar P vertical bar plus k to ensure that vertical bar w sub n plus Z

sub j vertical bar greater than vertical bar P vertical bar parenthesis because vertical bar w sub n plus Z sub j vertical bar greater than equal to vertical bar w sub n vertical bar minus

vertical bar z subj vertical bar greater than parenthesis vertical bar P vertical bar plus k parenthesis minus k equals vertical bar P vertical bar parenthesis. Note also that w sub

n equivalent to w sub 0 mod P. Thus w sub n plus z sub j equivalent to w sub 0 plus z sub j mod b sub j for each j equals 1, dot dot dot, N and hence parenthesis w sub n plus

z sub j parenthesis slash b sub j is an imaginary quadratic integer. Moreover, the magnitude of parenthesis w sub n plus z sub j parenthesis slash b sub j is

larger than 1, since b sub j is a divisor of P. It follows that w sub n plus z sub j is composite for each j equals 1, dot dot dot, N. This concludes the final case.

7 point 2 MAPLE Code for square root of 7 -connected E -Prime Plot

Input: Text file of integer data

read lib parenthesisrea d data parenthesis

data list colon definition symbol read data parenthesis c colon forward slashuser s forward slash phil forward slash test

dot out quotation mark comma integer comma 3 parenthesis semicolon with parenthesis plots parenthesis semicolon

point plot parenthesis data list comma scaling equals sign constrained comma axes equals sign none comma resolution equals sign

1600 comma symbol equals sign point comma symbol size equals sign 1 parenthesis semicolon

71 7 point 3 Code for the Gaussian Prime Viewer forward slash asterisk

This program displays an 80 x 80 portion of the complex plane, centered on the Gaussian Integer hard coded as G P REAL underscore PART and G P underscore IMAG underscore PART. Gauassian integers which are prime are highlighted as green in the grid. The program allows interactive scrolling within a 200 x 200 range.

The display window portion of this code comes directly from: Beginning Game Programming, third Ed., Chap. 4, Create underscoreSurfac e program.

Suggested improvements would be a drop down menu for input and quitting. also a read -out for current center of screen location, or a right click capability to retrieve current complex plane location.

Improvements to eliminate slight delay for scrolling are needed. forward slash asterisk number symbol include angle bracket windows dot h angle bracket number symbol include angle bracket d 3 d 9 dot h angle bracket number symbol include angle bracket s t d i o dot h angle bracket number symbol include angle bracket i o stream angle bracket number symbol include angle bracket m p i r dot h angle bracket

using namespace s t d semicolon number symbol pragma comment parenthesis lib comma quotation mark m p i r dot lib quotation mark parenthesis number symbol pragma comment parenthesis lib comma quotation mark d 3 d 9 dot lib quotation mark parenthesis forward slash forward slash application title

c o n s t string APP TITLE equals sign quotation mark Display Gaussian Prime Density quotation mark semicolon forward slash forward slashmacr o to read the keyboard number symboldefin e KEY underscore DOWN parenthesis v k underscore code parenthesis parenthesis parenthesis Get A sync Key State parenthesis v k underscore code parenthesis 0 x 8000 parenthesis 1 colon 0 parenthesis forward slash forward slashscree n resolution number symboldefin e SCREEN W 800 number symboldefin e SCREEN H 800 forward slash forward slashTes t values for a Gaussian Prime forward slash forward slash Set to display smallest 17 -isolated G -Prime from Gethner, as validation. number symboldefin e G P underscore REAL underscore PART quotation mark 2 0 7 8 5 2 0 7 quotation mark number symboldefin e G P underscore IMAG underscore PART quotation mark 0 quotation mark forward slash forward slash integers for primality testing int prime underscorefla g comma prime underscore prob commadi v underscore m p i r commathre e underscoremo d underscore 4 comma g prime underscore flag semicolon unsigned long start underscore int equals sign 9 9 9 9 9 9 9 9 semicolon char c h semicolon int g Int square bracket 201 square bracket square bracket 201 square bracket semicolon int col commaro w comma maxCo l comma max Row semicolon forward slash forward slash Direct 3 D objects L P DIRECT 3 D 9 d 3 d equals signNUL L semicolon L P DIRECT 3 D DEVICE 9 d 3d dev equals signNUL L semicolon L P DIRECT 3 D SURFACE 9 back buffer equals signNUL L semicolon L P DIRECT 3 D SURFACE 9 surface equals signNUL L semicolon bool gameover equals sign false semicolon

72 forward slash asterisk asterisk asterisk asterisk Viewer parenthesisGam e parenthesis initialization function asterisk asterisk forward slash bool Game underscore Init parenthesis H W N D h w n d parenthesis curly brace

int g prime equals sign 0 comma prob equals sign 10 semicolon

char c Big Real square bracket 200 square bracket comma c Big Imag square bracket 200 square bracket semicolon

max Row equals sign 201 semicolon forward slash forward slash Range of imaginary values loaded for viewing. max Col equals sign 201 semicolon forward slash forward slash Range of real values loaded for viewing.

s t r c p y parenthesis c Big Real comma G P underscore REAL underscore PART parenthesis semicolon forward slash forward slash hard coded until I add an input field in windows. s t r c p y parenthesis c Big Imag comma G P underscore IMAG underscore PART parenthesis semicolon forward slash forward slash hard coded until I add an input field in windows.

forward slash forward slash M P I R variables m p z underscore t m p Real Int comma m p Imag Int comma m p Norm comma m p S q Re Int comma m p S q I m Int comma m p Real comma Temp comma m p Imag Temp comma m p Zero semicolon

g m p underscore rand state underscore t r state semicolon forward slash forward slashspecia l variable used by M P I R for randomization g m p underscore rand init underscore m t parenthesis r state parenthesis semicolon

forward slash forward slash Initialize M P I R integers with char string comma base 10. m p z underscoreini t underscore set underscore s t r parenthesis m p Real Int comma c Big Real comma 10 parenthesis semicolon m p z underscoreini t underscore set underscore s t r parenthesis m p Imag Int comma c Big Imag comma 10 parenthesis semicolon m p z underscoreini t underscore set underscore s t r parenthesis m p Zero comma quotation mark 0 quotation mark comma 10 parenthesis semicolon

forward slash forward slash Initialize additional M P I R variables. m p z underscoreini t parenthesis m p Norm parenthesis semicolon m p z underscoreini t parenthesis m p S q Re Int parenthesis semicolon m p z underscoreini t parenthesis m p S q Im Int parenthesis semicolon m p z underscoreini t parenthesis m p Real Temp parenthesis semicolon m p z underscoreini t parenthesis m p Imag Temp parenthesis semicolon

forward slash forward slash Find Rectangular corner of display comma from centered input. m p z underscore sub underscore u i parenthesis m p Real Int comma m p Real Int comma 100 parenthesis semicolon m p z underscore sub underscore u i parenthesis m p Imag Int comma m p Imag Int comma 100 parenthesis semicolon

forward slash forward slash Array init for G -Prime display. for parenthesisco l equals sign 0 semicolonco l less thanma x Col semicolon col plus sign plus sign parenthesis curly brace

m p z underscoread d underscore u i parenthesis m p Imag Temp comma m p Imag Int comma col parenthesis semicolon

for parenthesis row equals sign 0 semicolon row less than max Row semicolon row plus sign plus sign parenthesis curly brace

m p z underscoread d underscore u i parenthesis m p Real Temp, m p Real Int commaro w parenthesis semicolon m p z underscoremu l parenthesis m p S q Re Int comma m p Real Temp comma m p Real Temp parenthesis semicolon m p z underscoremu l parenthesis m p S q Im Int comma m p Imag Temp comma m p Imag Temp parenthesis semicolon m p z underscoread d parenthesis m p Norm comma m p S q Re Int comma m p S q I m Int parenthesis semicolon

forward slash forward slash If Rational prime, reset Norm for primality test if parenthesis m p z underscore c m p parenthesis m p Imag Temp comma m p Zero parenthesis equals sign equals sign 0

ampersand ampersand m p z underscore congruent underscore u i underscore p parenthesis m p Real Temp comma 3 comma 4 parenthesis parenthesis m p z

underscore set parenthesis m p Norm comma m p Real Temp parenthesis semicolon

g prime equals sign m p z underscoreprobabl e underscore prime underscore p parenthesis m p Norm comma r state comma prob comma 0 parenthesis semicolon

g Int square bracket row square bracket square bracket col square bracket equals sign g prime semicolon curly brace curly brace forward slash forward slash initialize Direct 3 D d 3 d equals signDirec t 3 D Create 9 parenthesis D 3 D underscore S D K underscore VERSION parenthesis semicolon if parenthesis d 3 d equals sign equals sign NULL parenthesis

73 curly brace

Message Box parenthesis h w n d comma quotation mark Error initializing Direct 3 D quotation mark comma quotation mark Error quotation mark comma M B underscore O K parenthesis semicolon return false semicolon curly brace forward slash forward slash set Direct 3 D presentation parameters D 3 D PRESENT underscore PARAMETERS d 3 d p p semicolon Zero Memory parenthesis ampersand d 3 d p p comma size of parenthesis d 3 d p p parenthesis parenthesis semicolon d 3 d p p dot Windowed equals signTRU E semicolon d 3 d p p dot Swap Effect equals sign D 3 D SWAPEFFEC T underscoreDISCAR D semicolon d 3 d p p dot BackBuffe r Format equals sign D 3 D F M T underscore X 8 R 8 G 8 B 8 semicolon d 3 d p p dot BackBuffe r Count equals sign 1 semicolon d 3 d p p dot BackBuffe rWidt h equals signSCREE N W semicolon d 3 d p p dot BackBuffe r Height equals signSCREE N H semicolon d 3 d p p dot h Device Window equals sign h w n d semicolon

forward slash forward slash create Direct 3 D device d 3 d angle bracket Create Device parenthesis D 3 DADAPTE R underscore DEFAULT comma D 3 D DEV TYPE underscore HAL comma h w n d comma D 3 D CREATE underscoreSOFTWAR E underscore VERTEX PROCESSING comma ampersand d 3 d p p comma ampersand d 3 d dev parenthesis semicolon if parenthesis exclamation mark d 3 d dev parenthesis curly brace Message Box parenthesis h w n d comma quotation mark Error creating Direct 3 D device quotation mark comma quotation mark Error quotation mark comma M B underscore O K parenthesis semicolon return false semicolon curly brace forward slash forward slash clear the back buffer to black

d 3 d dev hyphen angle bracket Clear parenthesis 0 commaNUL L comma D 3 D CLEAR underscore TARGET comma D 3 D COLOR

underscore X R G B parenthesis 100 comma 100 comma10 0 parenthesis comma 1 dot 0 f comma 0 parenthesis semicolon

forward slash forward slash create pointer to the back buffer

d 3 d dev hyphen angle bracket GetBac k Buffer parenthesis 0 comma 0 comma D 3 DBAC K BUFFER underscore TYPE

underscore MONO comma ampersand back buffer parenthesis semicolon

forward slash forward slash create surface H RESULT result equals sign d 3 d dev hyphen angle bracket Create Off screen Plain Surface parenthesis 100 comma forward slash forward slash width of the surface 100 comma forward slash forward slashheigh t of the surface D 3 D F M T underscore X 8 R 8 G 8 B 8 comma forward slash forward slashsurfac e format D 3 D POOL underscore DEFAULT comma forward slash forward slash memory pool to use ampersand surface comma forward slash forward slashpointe r to the surface NULL parenthesis semicolon forward slash forward slashreserve d parenthesis always NULL parenthesis if parenthesis exclamation mark SUCCEEDED parenthesis parenthesis result parenthesis parenthesisretur n false semicolon return true semicolon curly brace forward slash asterisk asterisk asterisk asterisk Viewer parenthesisGam e parenthesis update function void Game underscore Run parenthesis H W N D h w n d parenthesis curly brace static int s h f t underscore R L equals sign6 0 semicolon static int s h f t underscore U D equals sign6 0 semicolon

forward slash forward slash make sure the Direct 3 D device is valid if parenthesis exclamation mark d 3 d dev parenthesisretur n semicolon

forward slash forward slash start rendering if parenthesis d 3 d dev hyphen angle bracketBegi n Scene parenthesis parenthesis parenthesis curly bracefo r parenthesisin t h c equals sign 0 semicolon h c angle bracket SCREEN H forward slash 10 semicolon h c plus sign plus sign parenthesis curly brace

74 for parenthesisin t w c equals sign 0 semicolon w c angle bracket SCREENW forward slash 10 semicolon w c plus sign plus sign plus sign plus sign parenthesis curly brace RECT rect semicolon int r comma g comma b semicolon

r equals sign 0 semicolon g equals sign25 0 asterisk g Int square bracket w c plus sign plus sign s h f t underscore R L square bracket square bracket h c plus sign plus sign s h f t underscore U D square bracket semicolon b equals sign 0 semicolon d 3 d dev hyphen angle bracketColo r Fill parenthesis surface commaNUL L comma D 3 D COLOR underscore X R G B parenthesis r comma g comma b parenthesis parenthesis semicolon forward slash forward slash copy the surface to the back buffer rect dot left equals sign w c asterisk 10 plus sign plus sign 1 semicolon rect dot right equals signrec t dot left plus sign plus sign 8 semicolon rect dotto p equals sign SCREEN H hyphen parenthesis h c plus sign plus sign 1 parenthesis asterisk 10 plus sign plus sign 1 semicolon rect dotbotto m equals signrec t dotto p plus sign plus sign 8 semicolon d 3 d dev->Stretch Rect parenthesis surface comma NULL, back buffer comma ampersandrec t comma D 3 D TEX F underscoreNON E parenthesis semicolon curly brace curly brace forward slash forward slashsto p rendering d 3 d dev hyphen angle bracket End Scene parenthesis parenthesis semicolon forward slash forward slash display the back buffer on the screen d 3 d dev hyphen angle bracketPresen t parenthesisNUL L commaNUL L commaNUL L commaNUL L parenthesis semicolon curly brace

forward slash forward slash check for escape key parenthesis to exit program parenthesis while parenthesis KEY underscore DOWN parenthesis V K underscore ESCAPE parenthesis parenthesis curly brace Post Message parenthesis h w n d comma W M underscore DESTROY comma 0 comma 0 parenthesis semicolon curly brace

if parenthesis KEY underscore DOWN parenthesis V K underscoreRIGH T parenthesis parenthesis s h f t underscore R L plus sign plus sign plus sign plus sign semicolon if parenthesis KEY underscore DOWN parenthesis V K underscoreLEF T parenthesis parenthesis s h f t underscore R L hyphen hyphen semicolon if parenthesis KEY underscore DOWN parenthesis V K underscore UP parenthesis parenthesis s h f t underscore U D plus sign plus sign plus sign plus sign semicolon if parenthesis KEY underscore DOWN parenthesis V K underscore DOWN parenthesis parenthesis s h f t underscore U D hyphen hyphen semicolon curly brace forward slash asterisk asterisk asterisk asterisk Viewer parenthesisGam e parenthesisshutdow n function asterisk asterisk forward slash void Game underscore End parenthesis H W N D h w n d parenthesis curly brace if parenthesissurfac e parenthesissurfac e hyphen angle bracketReleas e parenthesis parenthesis semicolon if parenthesis d 3 d dev parenthesis d 3 d dev hyphen angle bracketReleas e parenthesis parenthesis semicolon if parenthesis d 3 d parenthesis d 3 d hyphen angle bracketReleas e parenthesis parenthesis semicolon curly brace forward slash asterisk asterisk asterisk asteriskWindow s event callback function

L RESULT WIN A P I Win Proc parenthesis H W N D h W n d comma U I N T m s g comma W PARAM w Param comma L PARAM l Param parenthesis curly braceswitc h parenthesis m s g parenthesis curly brace case W M underscore DESTROY colongam e over equals sign true semicolon PostQui t Message parenthesis 0 parenthesis semicolon return 0 semicolon curly braceretur n Def Window Proc parenthesis h W n d comma m s g comma w Param, l Param parenthesis semicolon curly brace

75 asterisk asterisk Windows entry point function asterisk asterisk forward slash int WIN A P I WinMai n parenthesis H I N STANCE hInstance , H I N STANCE h Prev Instance, L P S T R l p C mdLine , int n C m d Show parenthesis curly brace forward slash forward slash create the window class structure W N D CLASS EX w c semicolon w c dot c b Size equals sign size of parenthesis W N D CLASS EX parenthesis semicolon w c dotstyl e equals sign C S underscore H R E DRAW vertical bar C S underscore V R E DRAW semicolon w c dot l p f n W n d Proc equals sign parenthesis W N D PROC parenthesisWi n Proc semicolon w c dot c b C l s Extra equals sign 0 semicolon w c dot c b W n d Extra equals sign 0 semicolon w c dot hInstanc e equals sign h Instance semicolon w c dot h Icon equals signNUL L semicolon w c dot hCurso r equals sign Load Cursor parenthesisNUL L comma I D C underscoreARRO W parenthesis semicolon w c dot h b rBackgroun d equals sign parenthesis H BRUSH parenthesisGe t StockObjec t parenthesis WHITE underscore BRUSH parenthesis semicolon w c dot l p s z Menu Name equals signNUL L semicolon w c dot l p s z Class Name equals signAP P TITLE dot c underscore s t r parenthesis parenthesis semicolon w c dot h Icon S m equals signNUL L semicolon Register Class Ex parenthesis ampersand w c parenthesis semicolon forward slash forward slash create a new window H W N D window equals sign Create Window parenthesisAP P TITLE dot c underscore s t r parenthesis parenthesis commaAP P TITLE dot c underscore s t r parenthesis parenthesis comma W S underscoreOVE R LAPP E D WINDOW, C W underscoreUS E DEFAULT comma C W underscore USE DEFAULT comma SCREEN W commaSCREE N H commaNUL L commaNUL L comma hInstanc e commaNUL L parenthesis semicolon forward slash forward slash was there an error creating the window question mark if parenthesis window equals sign equals sign 0 parenthesisretur n 0 semicolon

forward slash forward slashdispla y the window Show Window parenthesis window comma n C m d Show parenthesis semicolon Update Window parenthesis window parenthesis semicolon

forward slash forward slash initialize the viewer parenthesisgam e parenthesis if parenthesis exclamation markGam e underscoreIni t parenthesiswindo w parenthesis parenthesisretur n 0 semicolon

forward slash forward slash main message loop M S G message semicolon while parenthesis exclamation markgam e over parenthesis curly brace if parenthesis Peek Message parenthesis ampersand message comma NULL comma 0 comma 0 comma P M underscore REMOVE parenthesis parenthesis curly brace Translate Message parenthesis ampersand message parenthesis semicolon Dispatch Message parenthesis ampersandmessag e parenthesis semicolon

curly braceGam e underscore Run parenthesis window parenthesis semicolon curly brace

return message dot w Param semicolon curly brace

76 7 point 4 Code for the k -connected Eisenstein Prime Components

forward slash forward slashThi s programs finds the E -prime of largest magnitude for a s q r t parenthesis k parenthesis-connecte d component forward slash forward slash of Eisenstein primes. It also outputs the size of the component and other useful data. forward slash forward slash E Moat 64 dot c p p colonDefine s the entry point for the console application. number sign include quotation mark s t d a f x dot h quotation mark number sign include angle bracket i o stream angle bracket number sign include angle bracket m p i r dot h angle bracket number sign include angle bracket s t d i o dot h angle bracket number sign include angle bracket c o n i o dot h angle bracket number sign include angle bracket time dot h angle bracket number sign pragma comment parenthesis lib comma quotation mark m p i r dot lib quotation mark parenthesis number signdefin e COL underscore DIST 4 number signdefin e K underscore DIST 12 number signdefin e MAX underscoreTES T 42 number signdefin e DATA underscoreSIZ E 5 0 0 0 0 0 0 0 number signdefin e BUF underscore SIZE 6 0 0 0 0 number signdefin e MAX underscore I M A G underscoreCO L 4 0 0 0 0 0 number signdefin e OUT FILE quotation mark C colon backslashUser s backslash backslashuse r backslash backslashDeskto p backslash backslash E log 13 dotou t quotation mark FILE asterisk out underscore file semicolon

int flip square bracket 3 square bracket equals sign curly brace 0 curly brace semicolon forward slash forward slash used for defining 1 mod 6 of imag dot part. forward slash forward slash Define all ordered pairs for checking connection distance . forward slash forward slash All pairs listed for distances up to S q r t parenthesis1 6 parenthesis forward slash forward slashCurrentl y values are commented out to restrict test to S q r t parenthesis 12 parenthesis int mask square bracket MAX underscoreTES T square bracket square bracket 2 square bracket equals sign curly brace

forward slash forward slash curly brace 4 comma 4 curly brace comma forward slash forward slash1 6 forward slash forward slash curly brace 4 comma 3 curly brace comma forward slash forward slash1 3 curly brace 4 comma 2 curly brace comma forward slash forward slash1 2 forward slash forward slash curly brace 4 comma 1 curly brace comma forward slash forward slash1 3 forward slash forward slash curly brace 4 comma 0 curly brace comma forward slash forward slash1 6 forward slash forward slash curly brace 3 comma 4 curly brace comma forward slash forward slash1 3 curly brace 3 comma 3 curly brace comma forward slash forward slash 9 curly brace 3 comma 2 curly brace comma forward slash forward slash 7 curly brace 3 comma 1 curly brace comma forward slash forward slash 7 curly brace 3 comma 0 curly brace comma forward slash forward slash 9 forward slash forward slash curly brace 3 comma negative 1 curly brace comma forward slash forward slash1 3 curly brace 2 comma 4 curly brace comma forward slash forward slash1 2 curly brace 2 comma 3 curly brace comma forward slash forward slash 7 curly brace 2 comma 2 curly brace comma forward slash forward slash 4 curly brace 2 comma 1 curly brace comma forward slash forward slash 3 curly brace 2 comma 0 curly brace comma forward slash forward slash 4 curly brace 2 comma negative 1 curly brace comma forward slash forward slash 7 curly brace 2 comma negative 2 curly brace comma forward slash forward slash1 2 forward slash forward slash curly brace 1 comma 4 curly brace comma forward slash forward slash1 3 curly brace 1 comma 3 curly brace comma forward slash forward slash 7 curly brace 1 comma 2 curly brace comma forward slash forward slash 3 curly brace 1 comma 1 curly brace comma forward slash forward slash 1 curly brace 1 comma 0 curly brace comma forward slash forward slash 1 curly brace 1 comma negative 1 curly brace comma forward slash forward slash 3 curly brace 1 comma negative 2 curly brace comma forward slash forward slash 7 forward slash forward slash curly brace 1 comma negative 3 curly brace comma forward slash forward slash1 3

77 forward slash forward slash curly brace 0 comma 4 curly brace comma forward slash forward slash1 6 curly brace 0 comma 3 curly brace comma forward slash forward slash 9 curly brace 0 comma 2 curly brace comma forward slash forward slash 4 curly brace 0 comma 1 curly brace comma forward slash forward slash 1

curly brace 0 comma negative 1 curly brace comma forward slash forward slash 1 curly brace 0 comma negative 2 curly brace comma forward slash forward slash 4 curly brace 0 comma negative 3 curly brace comma forward slash forward slash 9 forward slash forward slash curly brace 0 comma negative 4 curly brace comma forward slash forward slash1 6 forward slash forward slash curly brace negative 1 comma 3 curly brace comma forward slash forward slash1 3 curly brace negative 1 comma 2 curly brace comma forward slash forward slash 7 curly brace negative 1 comma 1 curly brace comma forward slash forward slash 3 curly brace negative 1 comma 0 curly brace comma forward slash forward slash 1 curly brace negative 1 comma negative 1 curly brace comma forward slash forward slash 1 curly brace negative 1 comma negative 2 curly brace comma forward slash forward slash 3 curly brace negative 1 comma negative 3 curly brace comma forward slash forward slash 7 forward slash forward slash curly brace negative 1 comma negative 4 curly brace comma forward slash forward slash1 3 curly brace negative 2 comma 2 curly brace comma forward slash forward slash1 2 curly brace negative 2 comma 1 curly brace comma forward slash forward slash 7 curly brace negative 2 comma 0 curly brace comma forward slash forward slash 4 curly brace negative 2 comma negative 1 curly brace comma forward slash forward slash 3 curly brace negative 2 comma negative 2 curly brace comma forward slash forward slash 4 curly brace negative 2 comma negative 3 curly brace comma forward slash forward slash 7 curly brace negative 2 comma negative 4 curly brace comma forward slash forward slash 12 forward slash forward slash curly brace negative 3 comma 1 curly brace comma forward slash forward slash1 3 curly brace negative 3 comma 0 curly brace comma forward slash forward slash 9 curly brace negative 3 comma negative 1 curly brace comma forward slash forward slash 7 curly brace negative 3 comma negative 2 curly brace comma forward slash forward slash 7 curly brace negative 3 comma negative 3 curly brace comma forward slash forward slash 9 forward slash forward slash curly brace negative 3 comma negative 4 curly brace comma forward slash forward slash1 3 forward slash forward slash curly brace negative 4 comma 0 curly brace comma forward slash forward slash1 6 forward slash forward slash curly brace negative 4 comma negative 1 curly brace comma forward slash forward slash1 3 curly brace negative 4 comma negative 2 curly brace forward slash forward slash1 2 forward slash forward slash curly brace negative 4 comma negative 3 curly brace comma forward slash forward slash1 3 forward slash forward slash curly brace negative 4 comma negative 4 curly brace forward slash forward slash1 6 curly brace semicolon forward slash forward slash Procedure for re -initializing memory void re Init parenthesis char asterisk array comma underscore int 64 comma int 64 end parenthesis curly brace static int re l n i t C equals sign 0 semicolon

time underscore t t semicolon time parenthesis ampersand t parenthesis semicolon

for parenthesis underscore int 64 i equals sign semicolon i angle bracket semicolon i plus sign plus sign parenthesis curly brace tarra y square bracket i square bracket equals sign single quote x single quote semicolon curly brace re Init C plus sign plus sign semicolon print f parenthesis quotation mark backslash n Re- Init number sign d quotation mark comma re lnit C parenthesis semicolon print f parenthesis quotation mark backslash n start percent sign I 64 d end percent sign I 64 d quotation mark comma start comma end parenthesis semicolon time parenthesis ampersand t parenthesis semicolon print f parenthesis quotation mark percent sign s quotation mark comma c time parenthesis ampersand t parenthesis parenthesis semicolon f print f parenthesis out underscore file comma quotation mark percent sign s quotation mark comma c time parenthesis ampersand t parenthesis parenthesis semicolon curly brace forward slash forward slash Procedure for finding dynamic array index for given E- prime. underscore int 64 getInde x parenthesis underscore int 64 comma underscorein t 64 imag parenthesis curly brace underscore int 64 index comma half semicolon

78 half equals real forward slash 2 semicolon index equals half asterisk parenthesis half plus sign parenthesis real percent sign 2 parenthesis parenthesis plus sign imag semicolon index equalsinde x percent sign DATA underscoreSIZ E semicolon return index semicolon curly brace forward slash forward slash Procedure for setting 1 mod 6 pattern of imag dot part underscore int 64 Set Imag Pattern parenthesis underscorein t 64 re comma parenthesis curly brace int mod six commaima g semicolon mod six equals real percent sign 6 semicolon switch parenthesismo d six parenthesis curly brace case 0 colon imag equals 1 semicolon flip curly brace 0 curly brace equals 4 semicolon flip curly brace 1 curly brace equals 2 semicolon break semicolon case 1 colon imag equals 1 semicolon flip curly brace 0 curly brace equals 2 semicolon flip curly brace 1 curly brace equals 1 semicolon break semicolon case 2 colon imag equals 3 semicolon flip curly brace 0 curly brace equals 2 semicolon flip curly brace 1 curly brace equals 4 semicolon break semicolon case 3 colon imag equals 1 semicolon flip curly brace 0 curly brace equals 1 semicolon flip curly brace 1 curly brace equals 2 semicolon break semicolon case 4 colon imag equals 1 semicolon flip curly brace 0 curly brace equals 2 semicolon flip curly brace 1 curly brace equals 4 semicolon break semicolon case 5 colon imag equals 2 semicolon flip curly brace 0 curly brace equals 1 semicolon flip curly brace 1 curly brace equals 2 semicolon break semicolon default colon forward slash forward slashCod e break semicolon curly braceretur n imag semicolon

curly bracein t main parenthesisin t a r g c comma char asterisk a r g v curly brace curly brace parenthesis curly brace int mask underscore start commabu f underscore max equals 0 semicolon int e prime equals 0 commapro b equals 10 comma i n c equals 1 comma no underscore add commabu f underscore c comma e p underscore connected semicolon underscore int 64 r back underscore max equals 0 comma rMa x equals 0 comma i Max equals 0 comma real Back Seed equals 0 comma last underscore i d x semicolon underscore int 64 r Last comma i Last, buf underscore tot equals 0 comma tot Node equals 2 commanor m Max equals 0 semicolon underscore int 64 re Arg comma i m Arg comma rTem p comma i Temp comma r Curr comma i Curr comma real Delta equals 0 semicolon underscore int 64 i d x Mod comma i d x Temp Mod commanor m semicolon

79 char c Big Real curly brace 100 curly brace comma c Big Imag curly brace 100 curly brace semicolon char asterisk d array semicolon time underscore t t semicolon forward slash forward slash var for tracking time comma parenthesis from time dot h parenthesis forward slash forward slash buffer for primes that must be checked for connectivity during backtrack underscore int 64 u buffer curly brace BUF underscore SIZE curly brace curly brace 2 curly brace semicolon

out underscorefil e equals sign f open parenthesis OUT FILE comma quotation mark w quotation mark parenthesis semicolon if parenthesis out underscorefil e equals sign equals signNUL L parenthesis curly brace f print f parenthesis s t d err comma quotation mark Can not open output file back slash n quotation mark parenthesis semicolon system parenthesis quotation mark PAUSE quotation mark parenthesis semicolon exit parenthesis 8 parenthesis semicolon curly brace

forward slash forward slash Setup Dynamic Array d array equals sign parenthesis char asterisk parenthesis m a l l o c parenthesis DATA underscore SIZE asterisk size of parenthesis char parenthesis parenthesis semicolon forward slash forward slash Initialize Memory d array curly brace 0 curly brace equals sign single quote n single quote semicolon d array curly brace 1 curly brace equals sign single quote c single quote comma re Init parenthesis d array comma 2 comma DATA underscore SIZE forward slash 2 parenthesis semicolon print f parenthesis quotation mark percent sign d of char array initialized. back slash n quotation mark comma DATA underscore SIZE forward slash 2 parenthesis semicolon forward slash forward slash Set up 3 plus sign 0 w as first E hyphenin t to be tested using M PIR library s t r c p y parenthesis c Big Real comma quotation mark 3 quotation mark parenthesis semicolon s t r c p y parenthesis c Big Imag comma quotation mark 0 quotation mark parenthesis semicolon forward slash forward slash set up m p z type vars m p z underscore t m p Real Int comma m p Imag Int comma m p Norm comma m p S q R e Int comma m p S q I m Int comma m p Real Temp comma m p Imag Temp comma m p A B Int semicolon g m p underscore rand state underscore t r state semicolon forward slash forward slash set -up random var from M PIR lib. g m p underscore rand init underscore m t parenthesis r state parenthesis semicolon forward slash forward slash Init. m p z vars for use parenthesis M PIR lib parenthesis m p z underscoreini t underscore set underscore s t r parenthesis m p Real Int comma c Big Real comma 10 parenthesis semicolon m p z underscoreini t underscore set underscore s t r parenthesis m p Imag Int comma c Big Imag comma 10 parenthesis semicolon m p z underscoreini t parenthesis m p Norm parenthesis semicolon m p z underscoreini t parenthesis m p S q R eIn t parenthesis semicolon m p z underscoreini t parenthesis m p S q I m Int parenthesis semicolon m p z underscoreini t parenthesis m p A B Int parenthesis semicolon m p z underscoreini t parenthesis m p Real Temp parenthesis semicolon m p z underscoreini t parenthesis m p Imag Temp parenthesis semicolon tot Node equals sign 2 semicolon no underscore add equals sign 0 semicolon forward slash forward slash counts real values without connection. e p underscore connected equals sign 0 semicolon forward slash forward slash E -prime connected equals sign false forward slash forward slashBegi n incrementing through the real parts for parenthesis re Arg equals sign 3 semicolon re Arg angle bracket MAX underscore IMAG underscore COL semicolon r e Arg plus sign plus sign parenthesis curly brace if parenthesis parenthesis re Arg percent sign 1000 parenthesis equals sign equals sign 0 parenthesis curly brace forward slash forward slash outputs status and time every 1000 reals print f parenthesis quotation mark Real Arg equals sign percent sign I 64 d back slash n quotation mark comma re Arg parenthesis semicolon f print f parenthesis out underscorefil e comma quotation markRea l Arg equals sign percent sign I 64 d back slash n quotation mark commar e Arg parenthesis semicolon time parenthesis ampersand t parenthesis semicolon print f parenthesis quotation mark percent sign s quotation mark comma c time parenthesis ampersand t parenthesis parenthesis semicolon f print f parenthesis out underscorefil e comma quotation mark percent sign s quotation mark comma c time parenthesis ampersand t parenthesis parenthesis semicolon

curly brace forward slash forward slash If nothing added for set number of columns parenthesis real s parenthesisquit . if parenthesis no underscore add angle bracket COL underscore DIST parenthesis break semicolon

80 if parenthesis r eAr g percent sign 2 parenthesis forward slash forward slashWhe n real part is odd curly brace

i d x Mod equals sign get Index parenthesis r e Arg comma 0 parenthesis semicolon

forward slash asterisk asterisk asterisk This section checks to see if Memory needs R e -Init asterisk asterisk asterisk forward slash if parenthesis i d x Mod equals sign equals sign DATA underscore SIZE forward slash 2 hyphen MAX underscore IMAG underscore COL asterisk COL underscore DIST parenthesis curly brace

r eIni t parenthesis d array comma DATA underscore SIZE forward slash 2 comma DATA underscore SIZE parenthesis semicolon print f parenthesis quotation mark percent sign I 64 d was the Lo trigger point back slash n quotation mark comma i d x Mod parenthesis semicolon curly brace

else if parenthesis i d x Mod equals sign equals sign DATA underscore SIZE hyphen MAX underscore IMAG underscore COL asterisk COL underscore DIST parenthesis curly brace

r eIni t parenthesis d array comma 0 comma DATA underscore SIZE forward slash 2 parenthesis semicolon print f parenthesis quotation mark percent sign I 64 d was the Hi trigger point back slash n quotation mark comma i d x Mod parenthesis semicolon parenthesis asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk asterisk forward slash

if parenthesis r eAr g percent sign 3 equals sign equals sign 2 parenthesis forward slash forward slash If also 2 mod 3 test for primality. curly brace

i m Arg equals sign 0 semicolon forward slash forward slash If real value is a Rational E -Prime comma begin connectivity testing forward slash forward slash This section is identical to connectivity testing used later forward slash forward slash It was left as inline code for efficiency. if parenthesis m p z underscoreprobabl e underscore prime underscore p parenthesis m p Real Int comma r state comma prob comma 2 parenthesis parenthesis curly brace

buf underscore c equals sign 0 semicolon mask underscore start equals sign MAX underscore TEST forward slash 2 semicolon forward slash forward slash only need second half of mask for init dot test. d array square bracket i d x Mod square bracket equals sign single quote u single quote semicolon forward slash forward slash This for loop checks to see if E -prime is connected for parenthesis int i equals sign mask underscore start semicolon i less than sign MAX underscore TEST semicolon i plus sign

plus sign parenthesis curly brace r Temp equals sign r e Arg plus sign mask square bracket i square bracket square bracket 0 square bracket semicolon i Temp equals sign i m Arg plus sign mask square bracket i square bracket square bracket 1 square

bracket semicolon forward slash forward slash If mask value inbounds comma then check if parenthesis parenthesis i Temp greater than sign equals sign 0 parenthesis ampersand ampersand parenthesis i Temp angle bracket parenthesis r Temp plus sign 1 parenthesis forward slash 2 parenthesis ampersand ampersand parenthesis r Temp greater than sign 0 parenthesis parenthesis curly brace i d x Temp Mod equals sign get Index parenthesis r Temp comma i Temp parenthesis semicolon

if parenthesis d array square bracket i d x Temp Mod square bracket equals sign equals sign single quote c single quote parenthesis curly brace

e p underscore connected equals sign 1 semicolon forward slash forward slash current E -prime is connected to t Node plus sign plus sign semicolon i equals sign MAX underscore TEST semicolon forward slash forward slashforc e exit

forward slash forward slash store in buffer for check against unconnected u buffer square bracket 0 square bracket square bracket 0 square bracket equals sign r e Arg semicolon u buffer square bracket 0 square bracket square bracket 1 square bracket equals sign i m Arg semicolon

buf underscore c plus sign plus sign semicolon

norm equals sign r e Arg asterisk r e Arg hyphen r e Arg asterisk i m Arg plus sign i m Arg asterisk

i m Arg semicolon if parenthesis norm greater than sign norm Max parenthesis

curly brace norm Max equals sign norm semicolon r Max equals sign r e Arg semicolon

i Max equals sign i m Arg semicolon curly brace

forward slash forward slash set current E -prime to connected d array square bracket i d x Mod square bracket equals sign single quote c single quote semicolon

81 last underscore i d x equals sign i d x Mod semicolon r Last equals sign r e Arg semicolon i Last equals sign i m Arg semicolon curly brace curly brace curly brace

while parenthesis buf underscore c greater than sign 0 parenthesis forward slash forward slash Explore newly connected E

-primes curly brace forward slash forward slash set current seed node for checking unconnected leafs

r Curr equals sign u buffer square bracket buf underscore c hyphen 1 square bracket square bracket 0 square bracket semicolon

i Curr equals sign u buffer square bracket buf underscore c hyphen 1 square bracket square bracket 1 square bracket semicolon

for parenthesis int i equals sign mask underscore start semicolon i less than sign MAX underscore TEST semicolon i plus sign plus sign

parenthesis curly brace r Temp equals sign r Curr plus sign mask square bracket i square bracket square bracket 0 square bracket semicolon forward slash forward slash set leaf for checking i Temp equals sign i Curr plus sign mask square bracket i square bracket square bracket 1 square bracket semicolon

forward slash forward slash If mask value in bounds comma then check if parenthesis parenthesis i Temp greater than sign equals sign 0 parenthesis ampersand ampersand parenthesis i Temp less than sign parenthesis r Temp plus sign 1 parenthesis forward slash 2 parenthesis ampersand ampersand parenthesis r Temp greater than sign 0 parenthesis parenthesis curly brace i d x Temp Mod equals sign get Index parenthesis r Temp comma i Temp parenthesis semicolon

if parenthesis d array square bracket i d x Temp Mod square bracket equals sign equals sign single quote u single quote

parenthesis curly brace forward slash forward slash set unconnected E -prime leaf to connected d array square bracket i d x Temp Mod square bracket equals sign single quote c single quote semicolon

to t Node plus sign plus sign semicolon norm equals sign r Temp asterisk r Temp hyphen r Temp asterisk i Temp plus sign i Temp asterisk i Temp semicolon if parenthesis norm greater than sign norm Max parenthesis curly brace

norm Max equals sign norm semicolon r Max equals sign r Temp semicolon i Max equals sign i Temp semicolon curly brace

forward slash forward slash store in buffer for check against unconnected u buffer square bracket buf underscore c hyphen 1 square bracket square bracket 0 square bracket equals sign r Temp semicolon u buffer square bracket buf underscore c hyphen 1 square bracket square bracket 1 square bracket equals sign i Temp semicolon buf underscore c plus sign plus sign semicolon

if parenthesis buf underscore c greater than sign buf underscorema x parenthesis buf underscorema x equals sign buf underscore c semicolon real Delta equals sign r e Arg hyphen r Temp semicolon if parenthesis parenthesis real Delta parenthesis greater than sign r back underscorema x parenthesis curly brace

r back underscorema x equals sign real Delta semicolon real Back Seed equals sign r e Arg semicolon prin t f parenthesis quotation mark angle bracket percent sign I 64 d forward slash percent sign I 64 d percent sign quotation mark comma r back underscore max comma real Back Seed parenthesis semicolon f print f parenthesis out underscore file comma quotation mark angle bracket percent sign I 64 d forward slash percent sign I 64 d angle bracket quotation mark comma r back underscore max comma real Back Seed parenthesis semicolon curly brace curly brace curly brace curly brace forward slash forward slashen d quotation markmaskin g quotation mark For loop buf underscore c hyphen hyphen semicolon if parenthesis parenthesis mask underscorestar t greater than sign 0 parenthesis ampersand ampersand parenthesis buf underscore c equals sign equals sign 0 parenthesis parenthesis buf underscoreto t plus sign plus sign semicolon mask underscore start equals sign 0 semicolon curly brace forward slash forward slash end- while parenthesis unexplored buffer now empty parenthesis

82 curly brace forward slash forward slashen d if rat dot E -prime parenthesis connectivity testing parenthesis else d array square bracket i d x Mod square bracket equals sign single quote n single quote semicolon

curly brace forward slash forward slashen d if mod 3 else d array square bracket i d x Mod square bracket equals sign single quote n single quote semicolon curly brace forward slash forward slash end if 1 mod 2 forward slash forward slash Set start value of imag dot part for E -primality testing forward slash forward slash Also establishs pattern for incrementing through imag dot s i m Arg equals sign Set Imag Pattern parenthesis r e Arg parenthesis semicolon

m p z underscore set underscore u i parenthesis m p Imag Int comma i m Arg parenthesis semicolon forward slash forward slash Set Imag value into

M PIR var. while parenthesis i m Arg angle bracket parenthesis r e Arg plus sign 1 parenthesis forward slash 2 parenthesis curly brace

forward slash forward slash Calculate Norm using M PIR lib. m p z underscoremu l parenthesis m p S q R e Int comma m p Real Int comma m p Real Int parenthesis semicolon m p z underscoremu l parenthesis m p S q I m Int comma m p Imag Int comma m p Imag Int parenthesis semicolon m p z underscoremu l parenthesis m p A B Int comma m p Imag Int comma m p Real Int parenthesis semicolon m p z underscoread d parenthesis m p Norm comma m p S q R eIn t comma m p S q I m Int parenthesis semicolon m p z underscoresu b parenthesis m p Norm comma m p Norm comma m p A B Int parenthesis semicolon

forward slash forward slash Test E -int for primality.

e prime equals sign m p z underscoreprobabl e underscore prime underscore p parenthesis m p Norm comma r state comma prob comma

0 parenthesis semicolon

i d x Mod equals sign get Index parenthesis r e Arg comma i m Arg parenthesis semicolon

forward slash asterisk asterisk asterisk This section checks to see if Memory needs Re -Init asterisk asterisk asterisk forward slash if parenthesis i d x Mod equals sign equals sign DATA underscore SIZE forward slash 2 hyphen MAX underscore IMAG underscore COL asterisk COL underscore DIST parenthesis curly brace r eIni t parenthesis d array comma DATA underscore SIZE forward slash 2 comma DATA underscore SIZE parenthesis semicolon print f parenthesis quotation mark percent sign I 64 d was the Lo trigger point back slash n quotation mark comma i d x Mod parenthesis semicolon curly brace else if parenthesis i d x Mod equals sign equals sign DATA underscore SIZE hyphen MAX underscore IMAG underscore COL asterisk COL underscore DIST parenthesis curly brace r eIni t parenthesis d array comma 0 comma DATA underscore SIZE forward slash 2 parenthesis semicolon print f parenthesis quotation mark percent sign I 64 d was the Hi trigger point back slash n quotation mark comma i d x Mod parenthesis semicolon curly brace string of asterisk symbols forward slash

forward slash forward slash If E -integer is an E -Prime, begin connectivity testing forward slash forward slash This section is identical to connectivity testing used earlier forward slash forward slash It was left as inline code for efficiency. if parenthesis e prime equals sign equals sign 1 parenthesis curly brace

buf underscore c equals sign 0 semicolon mask underscore start equals sign MAX underscore TEST forward slash 2 semicolon forward slash forward slash only need second half of mask for init dot test. d array square bracket i d x Mod square bracket equals sign single quote u single quote semicolon forward slash forward slash This for loop checks to see if E -prime is connected for parenthesis int i equals sign mask underscore start semicolon i angle bracket MAX underscore TEST semicolon i plus sign plus sign parenthesis curly brace

r Temp equals sign r e Arg plus sign mask square bracket i square bracket square bracket 0 square bracket semicolon i Temp equals sign i m Arg plus sign mask square bracket i square bracket square bracket 1 square bracket semicolon

forward slash forward slash If mask value inbounds, then check if parenthesis parenthesis i Temp greater than sign equals sign 0 parenthesis ampersand ampersand parenthesis i Temp angle bracket parenthesis r Temp plus sign 1 parenthesis forward slash 2 parenthesis ampersand ampersand parenthesis r Temp angle

bracket 0 parenthesis parenthesis curly brace i d x Temp Mod equals sign get Index parenthesis r Temp comma i Temp parenthesis semicolon

83 if parenthesis d array square bracket i d x Temp Mod square bracket equals sign equals sign single quote c single quote parenthesis curly brace

e p underscore connected equals sign 1 semicolon forward slash forward slash current E -prime is connected to t Node plus sign plus sign semicolon i equals sign MAX underscore TEST semicolon forward slash forward slashforc e exit

forward slash forward slash store in buffer for check against unconnected u buffer square bracket 0 square bracket square bracket 0 square bracket equals sign r eAr g semicolon u buffer square bracket 0 square bracket square bracket 1 square bracket equals sign i m Arg semicolon

buf underscore c plus sign plus sign semicolon

norm equals sign r e Arg asterisk r e Arg hyphen r e Arg asterisk i m Arg plus sign i m Arg asterisk i m Arg semicolon if parenthesis norm greater than sign norm Max parenthesis curly brace

norm Max equals sign norm semicolon r Max equals sign r e Arg semicolon i Max equals sign i m Arg semicolon curly brace

forward slash forward slash set current E -prime to connected d array square bracket i d x Mod square bracket equals sign single quote c single quote semicolon last underscore i d x equals sign i d x Mod semicolon r Last equals sign r e Arg semicolon i Last equals sign i m Arg semicolon curly brace curly brace curly brace

while parenthesis buf underscore c greater than sign 0 parenthesis forward slash forward slash Explore newly connected E -primes curly brace

forward slash forward slash set current seed node for checking unconnected leafs r Curr equals sign u buffer square bracket buf underscore c hyphen 1 square bracket square bracket 0 square bracket semicolon i Curr equals sign u buffer square bracket buf underscore c hyphen 1 square bracket square bracket 1 square bracket semicolon

for parenthesis int i equals sign mask underscore start semicolon i angle bracket MAX underscore TEST semicolon i plus sign plus sign parenthesis curly brace

r Temp equals sign r Curr plus sign mask square bracket i square bracket square bracket 0 square bracket semicolon forward slash forward slash set leaf for checking i Temp equals sign i Curr plus sign mask square bracket i square bracket square bracket 1 square bracket semicolon forward slash forward slash If mask value inbounds, then check if parenthesis parenthesis i Temp greater than sign equals sign 0 parenthesis ampersand ampersand parenthesis i Temp angle bracket parenthesis r Temp plus sign 1 parenthesis forward slash 2 parenthesis ampersand ampersand parenthesis r Temp angle bracket 0 parenthesis parenthesis curly brace i d x Temp Mod equals sign get Index parenthesis r Temp comma i Temp parenthesis semicolon

if parenthesis d array square bracket i d x Temp Mod square bracket equals sign equals sign single quote u single quote parenthesis curly brace

forward slash forward slash set unconnected E -prime leaf to connected d array square bracket i d x Temp Mod square bracket equals sign single quote c single quote semicolon

to t Node plus sign plus sign semicolon norm equals sign r Temp asterisk r Temp hyphen r Temp asterisk i Temp plus sign i Temp asterisk i Temp semicolon if parenthesis norm greater than sign norm Max parenthesis curly brace

norm Max equals sign norm semicolon r Max equals sign r Temp semicolon i Max equals sign i Temp semicolon curly brace

forward slash forward slash store in buffer for check against unconnected u buffer square bracket buf underscore c hyphen 1 square bracket square bracket 0 square bracket equals sign r Temp semicolon u buffer square bracket buf underscore c hyphen 1 square bracket square bracket 1 square bracket equals sign i Temp semicolon

84 buf underscore c plus sign plus sign semicolon

if parenthesis buf underscore c greater than sign buf underscorema x parenthesis buf underscorema x equals sign buf underscore c semicolon real Delta equals sign r e Arg hyphen r Temp semicolon if parenthesis parenthesis real Delta parenthesis greater than sign r back underscorema x parenthesis curly brace r back underscorema x equals sign real Delta semicolon real Back Seed equals sign r e Arg semicolon print f parenthesis quotation mark angle bracket percent sign I 64 d forward slash percent sign I 64 d angle bracket quotation mark comma r back underscore max comma real Back Seed parenthesis semicolon f print f parenthesis out underscore file comma quotation mark angle bracket percent sign I 64 d forward slash percent sign I 64 d angle bracket quotation mark comma r back underscore max comma real Back Seed parenthesis semicolon curly brace curly brace curly brace curly brace forward slash forward slashen d quotation markmaskin g quotation mark For loop buf underscore c hyphen hyphen semicolon if parenthesis parenthesis mask underscorestar t greater than sign 0 parenthesis ampersand ampersand parenthesis buf underscore c equals sign equals sign 0 parenthesis parenthesis buf underscore to t plus sign plus sign semicolon mask underscore start equals sign 0 semicolon curly brace forward slash forward slashen d -while parenthesis unexplored buffer now empty parenthesis

curly brace forward slash forward slash end if E -prime parenthesis connectivity testing parenthesis else d array square bracket i d x Mod square bracket equals sign single quote n single quote semicolon

forward slash forward slash Increment through Imag dot s using pattern definition. m p z underscoread d underscore u i parenthesis m p Imag Int, m p Imag Int, flip square bracket 0 square bracket parenthesis semicolon i m Arg equals sign i m Arg plus sign flip square bracket 0 square bracket semicolon

forward slash forward slashRotat e Pattern settings flip square bracket 2 square bracket equals sign flip square bracket 0 square bracket semicolon flip square bracket 0 square bracket equals sign flip square bracket 1 square bracket semicolon flip square bracket 1 square bracket equals sign flip square bracket 2 square bracket semicolon

curly brace forward slash forward slash end i m Arg for forward slash while loop

forward slash forward slash increment M PIR real var. m p z underscoread d underscore u i parenthesis m p Real Int, m p Real Int comma 1 parenthesis semicolon

forward slash forward slash increment count on reals w forward slash o a connection added.

if parenthesis e p underscore connected equals sign equals sign 0 parenthesis no underscoread d plus sign plus sign semicolon else curly brace forward slash forward slashrese t no underscore add to zero if a connection was added. no underscoread d equals sign 0 semicolon e p underscore connected equals sign 0 semicolon curly brace

curly brace forward slash forward slash end r e Arg For loop forward slash forward slash Output of data at end of program

print f parenthesis quotation mark percent sign I 64 d total elements back slash n quotation mark comma to t Node parenthesis semicolon f print f parenthesis out underscorefil e comma quotation mark back slash n percent sign I 64 d total elements back slash n quotation mark commat o t Node parenthesis semicolon print f parenthesis quotation mark percent sign I 64 d Last index back slash n quotation mark comma last underscore i d x parenthesis semicolon f print f parenthesis out underscorefil e comma quotation mark percent sign I 64 d Last index back slash n quotation mark comma last underscore i d x parenthesis semicolon print f parenthesis quotation mark percent sign d was the largest buffer back slash n quotation mark comma buf underscorema x parenthesis semicolon f print f parenthesis out underscorefil e comma quotation mark percent sign d was the largest buffer back slash n quotation mark comma buf underscorema x parenthesis semicolon print f parenthesis quotation mark percent sign I 64 d was the largest Real back track back slash n quotation mark comma rback underscore max parenthesis semicolon f print f parenthesis out underscorefil e comma quotation mark percent sign I 64 d was the largest Real back track back slash n quotation mark comma r back underscore max parenthesis semicolon

85 print f parenthesis quotation mark percent sign I 64 d was the real seed of the largest real back track back slash n quotation mark comma real Back Seed parenthesis semicolon f print f parenthesis out underscorefil e comma quotation mark percent sign I 64 d was the real seed of the largest real back track back slash n quotation mark comma real Back Seed parenthesis semicolon print f parenthesis quotation mark percent sign I 64 d total elements that had NO back track back slash n quotation mark comma buf underscoreto t parenthesis semicolon f print f parenthesis out underscorefil e comma quotation mark percent sign I 64 d total elements that had NO back track back slash n quotation mark comma buf underscoret o t

parenthesis semicolon print f parenthesis quotation mark percent sign I 64 d equals signMa x Norm at the g hyphen int colon percent sign I 64 d plus sign percent sign I 64 d w back slash n quotation mark comma norm Max comma r Max comma i Max parenthesis semicolon f print f parenthesis out underscorefil e comma quotation mark percent sign I 64 d equals signMa x Norm at the g hyphen int: percent sign I 64 d plus sign percent sign I 64 d w back slash n quotation mark comma norm Max comma r Max comma i Max parenthesis semicolon print f parenthesis quotation mark Last value: percent sign I 64 d plus sign percent sign I 64 d w back slash n quotation mark comma r Last comma iLas t parenthesis semicolon f print f parenthesis out underscorefil e comma quotation mark Last value colon percent sign I 64 d plus sign percent sign I 64 d w back slash n quotation mark comma r Last comma i Last parenthesis semicolon f close parenthesis out underscorefil e parenthesis semicolon time parenthesis ampersand t parenthesis semicolon

print f parenthesis quotation mark percent sign s quotation mark comma c time parenthesis ampersand t parenthesis parenthesis semicolon

system parenthesis quotation mark PAUSE quotation mark parenthesis semicolon

return 0 semicolon curly brace

86 Bibliography

[1] T. Cormen and et al., Introduction to Algorithms, seconnd edition, M I T

Press, 20 01.

[2] D. S. Dummit and R. M. Foote, Abstract Algebra, third Edition, John

Wiley and Sons, 20 0 4.

[3] E. Gethner and H. M. Stark, Periodic gaussian moats, Experimental

Mathematics, 6 parenthesis 19 97 parenthesis , p p. 251 to 254.

[4] E. Gethner, S. Wagon, and B. Wick, A stroll through the gaussian

primes, American Mathematical Monthly, 105 colon 4 parenthesis 19 98 parenthesis , p p. 327 to 337.

[5] D. Hoffoss, The Rabin Miller Primality Test. University of San Diego.

h t t p colon forward slash forward slash home dotsa n diego dot e d u forward slash d hoffoss forward slash teaching forward slash cryptography forward slash 10 hyphen Rabin hyphen Miller dot p d f Retrieved Nov. 2, 20 14.

[6] K. Ireland and M. Rosen, A Classical Introduction to Modern Number

Theory, second Edition, Springer hyphen Verlag, 19 90.

87 [7] J. Harbour, Beginning Game Programming third Edition, Cengage

Learning, 20 10.

[8] J. Silverman, A Friendly Introduction to Number Theory, Pearson

Prentice Hall, 20 0 6.

[9] N. Tsuchimura, Computational results for gaussian moat problem,

Mathematical Engineering Technical Reports, M E T R 20 0 4 to1 3

parenthesis 20 04 parenthesis , p p. 1 to14 .

[10] I. Vardi, Prime percolation, Experimental Mathematics, 7 colon 3 parenthesis 19 98 parenthesis,

p p. 275 to 288.

[11] E. Weisstein, Eisenstein Primes. Math World hyphen A Wolfram Web Resource.

h t t p colon forward slash forward slashmat h world dot wolfram dot com forward slashEisenstei n Prime dot

h t m l Retrieved Nov. 2, 20 14.

[12] S. Y. Yan, Computational Number Theory and Modern Cryptography,

John Wiley and Sons, 20 13.

[13] Z. Zhang and M. Tang, Finding strong pseudoprimes to several bases i i.,

Mathematics of Computation, 72 parenthesis 20 0 3 parenthesis , p p. 244 to 250.

88