PERIOD LENGTH EQUALITY FOR THE NEAREST INTEGER AND NEAREST SQUARE CONTINUED FRACTION EXPANSIONS OF A QUADRATIC SURD

Similar documents
CONTINUED FRACTIONS AND PELL S EQUATION. Contents 1. Continued Fractions 1 2. Solution to Pell s Equation 9 References 12

Continued Fractions and the Euclidean Algorithm

CONTINUED FRACTIONS AND FACTORING. Niels Lauritzen

An example of a computable

Continued Fractions. Darren C. Collins

On continued fractions of the square root of prime numbers

PRIME FACTORS OF CONSECUTIVE INTEGERS

6 EXTENDING ALGEBRA. 6.0 Introduction. 6.1 The cubic equation. Objectives

On the largest prime factor of x 2 1

How To Factorize Of Finite Abelian Groups By A Cyclic Subset Of A Finite Group

Math Circle Beginners Group October 18, 2015

CS 103X: Discrete Structures Homework Assignment 3 Solutions

MATH10040 Chapter 2: Prime and relatively prime numbers

GREATEST COMMON DIVISOR

AMBIGUOUS CLASSES IN QUADRATIC FIELDS

it is easy to see that α = a

Irreducibility criteria for compositions and multiplicative convolutions of polynomials with integer coefficients

WHEN DOES A CROSS PRODUCT ON R n EXIST?

FACTORING CERTAIN INFINITE ABELIAN GROUPS BY DISTORTED CYCLIC SUBSETS

International Journal of Information Technology, Modeling and Computing (IJITMC) Vol.1, No.3,August 2013

Some Polynomial Theorems. John Kennedy Mathematics Department Santa Monica College 1900 Pico Blvd. Santa Monica, CA

A simple criterion on degree sequences of graphs

Breaking The Code. Ryan Lowe. Ryan Lowe is currently a Ball State senior with a double major in Computer Science and Mathematics and

HOMEWORK 5 SOLUTIONS. n!f n (1) lim. ln x n! + xn x. 1 = G n 1 (x). (2) k + 1 n. (n 1)!

SHARP BOUNDS FOR THE SUM OF THE SQUARES OF THE DEGREES OF A GRAPH

Math 181 Handout 16. Rich Schwartz. March 9, 2010

9.2 Summation Notation

RINGS WITH A POLYNOMIAL IDENTITY

5. Factoring by the QF method

CHAPTER 5. Number Theory. 1. Integers and Division. Discussion

TAKE-AWAY GAMES. ALLEN J. SCHWENK California Institute of Technology, Pasadena, California INTRODUCTION

On the irreducibility of certain polynomials with coefficients as products of terms in an arithmetic progression

The sum of digits of polynomial values in arithmetic progressions

FACTORING POLYNOMIALS IN THE RING OF FORMAL POWER SERIES OVER Z

MATHEMATICAL INDUCTION. Mathematical Induction. This is a powerful method to prove properties of positive integers.

A REMARK ON ALMOST MOORE DIGRAPHS OF DEGREE THREE. 1. Introduction and Preliminaries

arxiv:math/ v1 [math.st] 28 Dec 2001

Degrees that are not degrees of categoricity

11 Ideals Revisiting Z

Notes on Factoring. MA 206 Kurt Bryan

arxiv: v1 [math.pr] 5 Dec 2011

Math Workshop October 2010 Fractions and Repeating Decimals

Mathematical Induction. Lecture 10-11

SUBGROUPS OF CYCLIC GROUPS. 1. Introduction In a group G, we denote the (cyclic) group of powers of some g G by

STUDENT S SOLUTIONS MANUAL ELEMENTARY NUMBER THEORY. Bart Goddard. Kenneth H. Rosen AND ITS APPLICATIONS FIFTH EDITION. to accompany.

mod 10 = mod 10 = 49 mod 10 = 9.

Math 55: Discrete Mathematics

Elementary Number Theory and Methods of Proof. CSE 215, Foundations of Computer Science Stony Brook University

Computing divisors and common multiples of quasi-linear ordinary differential equations

ADDITIVE GROUPS OF RINGS WITH IDENTITY

PYTHAGOREAN TRIPLES KEITH CONRAD

THE REGULAR OPEN CONTINUOUS IMAGES OF COMPLETE METRIC SPACES

arxiv:math/ v3 [math.nt] 25 Feb 2006

CHAPTER II THE LIMIT OF A SEQUENCE OF NUMBERS DEFINITION OF THE NUMBER e.

1 if 1 x 0 1 if 0 x 1

arxiv:math/ v1 [math.co] 21 Feb 2002

SCORE SETS IN ORIENTED GRAPHS

Lecture 13: Factoring Integers

F. ABTAHI and M. ZARRIN. (Communicated by J. Goldstein)

The Australian Journal of Mathematical Analysis and Applications

Solutions for Practice problems on proofs

Properties of BMO functions whose reciprocals are also BMO

Section 4.2: The Division Algorithm and Greatest Common Divisors

Our Primitive Roots. Chris Lyons

Prime power degree representations of the symmetric and alternating groups

Cycles in a Graph Whose Lengths Differ by One or Two

arxiv: v2 [math.ho] 4 Nov 2009

Jacobi s four squares identity Martin Klazar

y intercept Gradient Facts Lines that have the same gradient are PARALLEL

3. Mathematical Induction

About the inverse football pool problem for 9 games 1

DEGREES OF ORDERS ON TORSION-FREE ABELIAN GROUPS

Further Study on Strong Lagrangian Duality Property for Invex Programs via Penalty Functions 1

An Innocent Investigation

PROOFS BY DESCENT KEITH CONRAD

How To Know If A Domain Is Unique In An Octempo (Euclidean) Or Not (Ecl)

There is no degree invariant half-jump

On Generalized Fermat Numbers 3 2n +1

ON DEGREES IN THE HASSE DIAGRAM OF THE STRONG BRUHAT ORDER

CONTRIBUTIONS TO ZERO SUM PROBLEMS

A Negative Result Concerning Explicit Matrices With The Restricted Isometry Property

Algebra 1 Course Title

Zero: If P is a polynomial and if c is a number such that P (c) = 0 then c is a zero of P.

ON FIBONACCI NUMBERS WITH FEW PRIME DIVISORS

Cardinality. The set of all finite strings over the alphabet of lowercase letters is countable. The set of real numbers R is an uncountable set.

Homework until Test #2

The Settling Time Reducibility Ordering and 0 2 Setting

A Study on the Necessary Conditions for Odd Perfect Numbers

Core Maths C1. Revision Notes

How To Prove The Dirichlet Unit Theorem

SECTION 10-2 Mathematical Induction

= = 3 4, Now assume that P (k) is true for some fixed k 2. This means that

1 Homework 1. [p 0 q i+j p i 1 q j+1 ] + [p i q j ] + [p i+1 q j p i+j q 0 ]

Biinterpretability up to double jump in the degrees

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2

Sign changes of Hecke eigenvalues of Siegel cusp forms of degree 2

SEQUENCES OF MAXIMAL DEGREE VERTICES IN GRAPHS. Nickolay Khadzhiivanov, Nedyalko Nenov

ON UNIQUE FACTORIZATION DOMAINS

I. GROUPS: BASIC DEFINITIONS AND EXAMPLES

How to Gamble If You Must

Transcription:

GLASNIK MATEMATIČKI Vol. 46(66)(011), 69 8 PERIOD LENGTH EQUALITY FOR THE NEAREST INTEGER AND NEAREST SQUARE CONTINUED FRACTION EXPANSIONS OF A QUADRATIC SURD Keith R. Matthews and John P. Robertson University of Queensland and Australian National University, Australia and National Council on Compensation Insurance, USA Abstract. We prove equality of the period lengths of the nearest integer continued fraction and the nearest square continued fraction, for arbitrary real quadratic irrationals. 1. Introduction The oldest method known to give the general solution to Pell s equation is the cyclic method ([1, 14]), studied by Jayadeva, Bhaskara II, and others beginning in the 10th century or earlier ([15, p. 35]). The nearest square continued fraction (denoted by NSCF) is a variant of the cyclic method and so is one of the earliest continued fractions discovered. Despite its great age, it has not been studied to the same extent as many other continued fractions. The first systematic study of the nearest square continued fraction was done by A.A.K. Ayyangar ([]). The nearest square continued fraction has nice properties similar to the more-studied regular continued fraction [1, p. ]) and nearest integer continued fraction ([1, pp. 143, 160]) (denoted by RCF and NICF, respectively), such as easy criteria for finding the middle of the period of the expansion of D without computing the whole period, with the NICF and NSCF at times having some superiority over the RCF (see [8], [11] and [16]); symmetry properties for periods for certain classes of quadratic surd; and easy criteria for determining whether a quadratic surd has a purely periodic expansion. We were quite astounded to discover that the period length for the NSCF is the same as that for the NICF, despite the more 010 Mathematics Subject Classification. 11A55, 11Y65. Key words and phrases. Nearest square continued fraction, nearest integer continued fraction, period length, reduced quadratic irrational. 69

70 K. R. MATTHEWS AND J. P. ROBERTSON complicated definition of the NSCF. The NSCF expansion of a quadratic surd is closely related to the optimal continued fraction (OCF) of W. Bosma ([3]) and is the basis for a recent computer algorithm [9] by the first author, for the finding the OCF of a quadratic surd. The RCF, NICF and NSCF are expansionsofan irrationalnumber ξ 0 as a semi regular continued fraction ([1, p. 137]): ξ 0 = a 0 + ǫ 1 + + ǫ n +, a 1 an where ǫ n = ±1 for each n and the a n are generated by the recurrencerelations (1.1) (1.) ξ n = a n + ǫ n+1, n 0, ξ n+1 ξ n if ǫ n+1 = 1, a n = ξ n +1 if ǫ n+1 = 1, where ξ n denotes the integer part of ξ n. The ξ n are called the complete quotients and ξ n > 1 if n 1, by (1.1) and (1.). The ǫ n+1 and a n are called partial numerators and denominators, respectively. The RCF is defined by a n = ξ n, and ǫ n+1 = 1. The NICF is defined by a n = [ξ n ], (the nearest integer to ξ n ) and ǫ n+1 = sign(ξ n a n ), so that ξ n a n < 1, ξ n+1 > for n 0 and hence a n for n 1. TheNSCFisdefinedonlyforrealquadraticsurdsξ 0 = P0+ D Q 0 instandard form, i.e., D is a non-square positive integer and P 0,Q 0 0,(D P 0 )/Q 0 are integers, having no common factor other than 1. Then for n 0, with ξ n = Pn+ D Q n in standard form and c n = ξ n, we have positive and negative representations (1.3) ξ n = P n + D Q n = c n + Q n+1 P n+1 + D = c n +1 n+1 n+1 + D, where P n+1 + D Q > 1 and P n+1 + D > 1 are also in standard form. Then the n+1 n+1 NSCF is defined by choosing c n if Q n+1 (a) a n = < Q n+1, or Q n+1 = Q n+1 and Q n < 0, c n +1 if Q n+1 > Q n+1, or Q n+1 = Q n+1 and Q n > 0, (b) ǫ n+1 = sign(ξ n a n ). If Q n,q n+1, n+1 are all positive, (a) simplifies to c n if Q n+1 < a n = n+1, c n +1 if Q n+1 Q n+1. Then (1.1) and (1.3) give (P n+1 + D)/Q n+1 if ǫ n+1 = 1, ξ n+1 = ( n+1 + D)/ n+1 if ǫ n+1 = 1.

PERIOD LENGTH EQUALITY FOR NICF AND NSCF 71 The RCF, NICF and NSCF expansions of a quadratic surd become periodic, i.e., the complete quotients ξ n satisfy ξ i = ξ i+k for i i 0 for some k 1. Then ǫ i+1 = ǫ i+k+1 and a i = a i+k for all i i 0. The least such k is called the period length (see Satz 3. of [1, p. 66] for the RCF, where the proof of periodicity also holds for the NICF, by Satz 5.18(B) of [1, p. 161] and Theorem II of [, p. 5] for the NSCF). Let L-RCF, L-NICF and L-NSCF be the period lengths of the RCF, NICF and NSCF expansions of ξ 0. Also let N-NICF and N-NSCF be the number of partial numerators ǫ i = 1 in the respective NICF and NSCF periods of ξ 0. We prove L-NICF = L-NSCF by showing that if ξ 0 is not equivalent to (1+ 5)/, i.e., its RCF period has at least one a i > 1, then (1.4) (1.5) (1.6) L-NICF+N-NICF = L-RCF, L-NSCF+N-NSCF = L-RCF, N-NICF = N-NSCF, while if ξ 0 is equivalent to (1+ 5)/, then L-NICF = L-NSCF = 1. We remark that (1.4) is an immediate consequence of the RCF to NICF singularization algorithm described in Section.11(i) of [7]. To prove (1.5) and (1.6), we reduce the problem to the case of a purely periodic regular continued fraction and study its transformation into the NSCF expansion, using Theorem.4. It is then a matter of studying the effect on strings of consecutive RCF partial quotients equal to 1. We have to makeuseofcertainapproximation constantsθ n. WeproveN-NSCF=N-NICF by showing that if there are k strings of consecutive 1 s among the partial quotients of an RCF period and the length of the i-th string is l i, then k li +1 (1.7) N-NSCF =. i=1 We note that (1.7) holds with N-NSCF replaced by N-NICF, as a consequence of the RCF to NICF singularization process in Section.11(i) of [7].. Selenius Lemma and the RCF to NSCF transformation C.-O. Selenius ([13, 43, p. 63]) gave an algorithm for converting the RCF expansion of D to its NSCF expansion. The algorithm generalizes to a wider class of quadratic irrationals and is given as Theorem.4. We call a quadratic surd ξ 0 quasi reduced if either (i) ξ 0 isanrcf reducedquadraticirrational(i.e., ξ 0 hasapurelyperiodic RCF expansion, or equivalently ([1, ]) ξ 0 > 1 and 1 < ξ 0 < 0), or (ii) 0 < Q 0 < D and ξ 1 is an RCF reduced quadratic irrational.

7 K. R. MATTHEWS AND J. P. ROBERTSON Lemma.1. If ξ 0 is quasi reduced and ξ 0,ξ 1,... denote the complete P quotients of the RCF expansion of 0+ D Q 0, with positive and negative representations for ν 0: (.1) ξ ν = P ν + D Q ν = a ν + Q ν+1 P ν+1 + D = a ν +1 ν+1 ν+1 + D, where a ν = ξ ν, then Q ν+1, ν+1,p ν+1, ν+1 are positive for ν 0. Proof. This follows from [, Theorem I(iv), p. ]. Lemma.. With the notation of (.1), (i) If ξ 0 is a quadratic irrational and a ν = 1, where ν 1, then (a) ν = Q ν+1 and conversely, (b) ν = P ν+1 +Q ν+1. (ii) If ξ 0 is quasi reduced, then ν Q ν implies a ν = 1. Proof. See Satz 37 of [13, p. 6], where the results are given for ξ 0 = D, but remain valid for the more general case here. (.) Remark.3. We note from Lemma. that if ν Q ν, then ν + D = P ν+1 +Q ν+1 + D = ξ ν+1 +1. ν Q ν+1 Theorem.4. Let ξ 0 be a quasi reduced quadratic surd with RCF complete quotients ξ n = Pn+ D Q n and partial quotients a n. Let ǫ m and f(m) be recursively defined for m 0, as follows: Let ǫ 0 = 1, f(0) = 0 and suppose ǫ m and f(m) are defined and ξ f(m) has positive and negative representations (.3) ξ f(m) = a f(m) + Let (.4) ǫ m+1 = and (.5) f(m+1) = Also for m 0, let (.6) ξm = Q f(m)+1 P f(m)+1 + D = a f(m) +1 1, if Qf(m)+1 < f(m)+1, 1, if Q f(m)+1 f(m)+1 f(m)+1, if ǫ m+1 = 1, f(m)+, if ǫ m+1 = 1. ξ f(m), if ǫ m = 1, ξ f(m) +1, if ǫ m = 1. f(m)+1 f(m)+1 + D.

PERIOD LENGTH EQUALITY FOR NICF AND NSCF 73 and a f(m), if ǫ m = 1, ǫ m+1 = 1, (.7) ã m = a f(m) +1, if ǫ m ǫ m+1 = 1, a f(m) +, if ǫ m = 1, ǫ m+1 = 1. Then ξ m,ǫ m+1 and ã m are the complete quotients, partial numerators and denominators of the NSCF expansion of ξ 0. Proof. We use induction on m 0 to prove that ξ m is the m-th NSCF complete quotient. As ǫ 0 = 1, (.6) gives ξ 0 = ξ 0. Now assume that ξ m is the m-th complete NSCF quotient of ξ 0. Then (.6) gives the positive and negative representations (.8) ξm = c m + where (.9) c m = Q f(m)+1 P f(m)+1 + D = c m +1 a f(m) if ǫ m = 1, a f(m) +1 if ǫ m = 1. f(m)+1 f(m)+1 + D, If ξ denotes the (m+1)-th NSCF complete quotient of ξ 0, from (.8) we have (.10) ξ = P f(m)+1 + D Q f(m)+1, if Q f(m)+1 < f(m)+1, f(m)+1 + D f(m)+1, if Q f(m)+1 f(m)+1. But ǫ m+1 = 1 = Q f(m)+1 < f(m)+1. Also ǫ m+1 = 1 = Q f(m)+1 Pf(m)+1 f(m)+1 and hence + D = ξ f(m)+ +1, by Lemma.. Then (.10) f(m)+1 gives ξ = ξ f(m)+1 = ξ f(m+1), if ǫ m+1 = 1, ξ f(m)+ +1 = ξ f(m+1) +1, if ǫ m+1 = 1, = ξ m+1 and the induction goes through.

74 K. R. MATTHEWS AND J. P. ROBERTSON From (.8), we see that the m-th NSCF partial denominator a is given by cm, if Q f(m)+1 < f(m)+1 a =, i.e., if ǫ m+1 = 1, (.11) c m +1, if Q f(m)+1 f(m)+1, i.e., if ǫ m+1 = 1, a f(m), if ǫ m = 1 = ǫ m+1, a f(m) +1, if ǫ m = 1,ǫ m+1 = 1, = a f(m) +1, if ǫ m = 1,ǫ m+1 = 1, a f(m) +, if ǫ m = 1,ǫ m+1 = 1, = ã m. Next, from (.8) and (.11), Q f(m)+1 P f(m)+1 + ξ > 0, if ǫ D m+1 = 1, m ã m = Q f(m)+1 < 0, if ǫ f(m)+1 + D m+1 = 1. Hence sign( ξ m ã m ) = ǫ m+1. Table 1 from [13, pp. 65 66] gives the RCF and NSCF expansions of 97 as far as the end of the first RCF period. The RCF expansion is 97 = [9,1,5,1,1,1,1,1,1,5,1,18]. If ξ m occurs at line n = f(m) of the RCF positive and negative representation and Q n+1 < n+1, then ξ m+1 = ξ n+1 ; otherwise we proceed to line n+ and ξ m+1 = ξ n+ + 1. Here (P,Q) denotes P+ 97 Q, ξ j = (P j + 97)/Q j and ξ k = ( P k + 97)/ Q k. Then f(1) =,f() = 4,f(3) = 6,f(4) = 7,f(5) = 9,f(6) = 11,f(7) = 13, ǫ 1 = 1,ǫ = 1,ǫ 3 = 1,ǫ 4 = 1,ǫ 5 = 1,ǫ 6 = 1,ǫ 7 = 1 and 97 = 10 1 7 1 3 1 + 1 1 7 1 0 where the asterisks denote the period ξ 1 = ξ 7. By contrast, we have the NICF expansion: 97 = 10 1 7 1 3 1 3 1 + 1 6 1 0 Lemma.5. For each ξ n, n 1 in the RCF to NSCF transformation where a n > 1, there exists an m 0 such that n = f(m). Proof. NSCF: Let a n > 1 and f(m) n < f(m+1). If f(m) < n, then f(m+1) = f(m)+ and ǫ m+1 = 1; also n = f(m)+1. Hence Q f(m)+1 f(m)+1 and so by Lemma.(ii), a n = a f(m)+1 = 1, a contradiction. Hence n = f(m).

PERIOD LENGTH EQUALITY FOR NICF AND NSCF 75 RCF NSCF ξ 0 = (0,1) = 9 + (9,16) 1 = 10 (10,3) 1 ξ 0 = 9 + (9,16) 1 = 10 (10,3) 1 (16>3) ξ 1 = (9,16) = 1 + (7,3) 1 = (3,7) 1 ξ = (7,3) = 5 + (8,11) 1 = 6 (11,8) 1 ξ 1 = 6 + (8,11) 1 = 7 (11,8) 1 (11>8) ξ 3 = (8,11) = 1 + (3,8) = (14,9) ξ 4 = (3,8) = 1 + (5,9) 1 = (13,9) 1 ξ = + (5,9) 1 = 3 (13,9) 1 (9=9) ξ 5 = (5,9) = 1 + (4,9) 1 = (13,8) 1 ξ 6 = (4,9) = 1 + (5,8) 1 = (14,11) 1 ξ 3 = + (5,8) 1 = 3 (14,11) 1 (8<11) ξ 7 = (5,8) = 1 + (3,11) 1 = (11,3) 1 ξ 4 = 1 + (3,11) 1 = (11,3) 1 (11>3) ξ 8 = (3,11) = 1 + (8,3) 1 = (19,4) 1 ξ 9 = (8,3) = 5 + (7,16) 1 = 6 (10,1) 1 ξ 5 = 6 + (7,16) 1 = 7 (10,1) 1 (16>1) ξ 10 = (7,16) = 1 + (9,1) 1 = (5,33) 1 ξ 11 = (9,1) = 18 + (9,16) 1 = 19 (10,3) 1 ξ 6 = 19 + (9,16) 1 = 0 (10,3) 1 (16>3) Table 1. RCF to NSCF algorithm for 97. 3. The Q-γ law of Selenius Selenius defined his SK continued fraction expansion of a real number ξ 0 by comparing the approximation constants Θ n and Θ n 1. In the case ξ 0 = D, he demonstrated a closeness with the NSCF expansion in Satz 38, [13, p. 67], using the following result. Lemma 3.1. Let Θ n = B n B n ξ 0 A n, where A n /B n is the n-th RCF convergent to ξ 0 = (P 0 + D)/Q 0. Suppose Q n and Q n+1 are positive for all large n 0. (a) If n is sufficiently large (e.g., B n B n 1 > Q 0 ) and Q n+1 Q n, then (3.1) Q n+1 < Q n Θ n < Θ n 1. Moreover if ξ 0 = D, then equation (3.1) holds for n 1. (b) If Q n+1 = Q n, then for n 1, ( 1) n (Θ n Θ n 1 ) > 0. Selenius stated his result in terms of γ n = 1/Θ n 1. Proof. See Satz 9, [13, p. 5]. 4. Inequalities for the Θ n Fortunately there exist inequalities for the Θ n, which by virtue of Lemma 3.1, translate to inequalities between Q n and Q n+1. The former inequalities are due to Selenius ([13, 4, p. 37]) and subsequently W. Bosma and C. Kraaikamp. Lemma 4.1. Let ξ 0 be an irrational number with RCF expansion x = [a 0,a 1,...,a n,1 m,a n+m+1,...],

76 K. R. MATTHEWS AND J. P. ROBERTSON where 1 m denotes a sequence of consecutive partial quotients equal to 1, i.e., a n > 1 if n 1 and a n+1 = = a n+m = 1,a n+m+1 > 1. Then (i) If m is odd, (4.1) Θ n+e > Θ n+e+1 if 0 e m 1,e even. (ii) If m is even, m = k, (4.) Θ n+e > Θ n+e+1 if 0 e k,e even, (4.3) Θ n+f > Θ n+f+1 if k f k 1,f odd. (iii) If m = k,k even, (4.4) Θ n+k < Θ n+k+1. (iv) If m = k,k odd, k 3, (4.5) Θ n+k+1 < Θ n+k+. Proof. These follow from [4, Theorem., p. 485], except for the case f = k 1 of (4.3), which is easily proved using Lemma.1 of [4, p. 485]. 5. Equality of consecutive Q i s in a unisequence Lemma3.1giveslittle informationwhen Q n+1 = Q n. The followingresult identifies n and is used in the proof of Lemma 7.1. Lemma 5.1. Suppose ξ 0 is RCF reduced with period length l. Then if a n > 1,a n+1 = = a n+m = 1,a n+m+1 > 1,n + m + 1 l and Q v = Q v+1,n+1 v < n+m, we have m = k and v = n+k. Proof. Suppose Q v = Q v+1. Then D = P v+1 +Q vq v+1 = P v+1 +Q v+1 and ξ v+1 = (q + p +q )/p, where p = Q v+1 and q = P v+1. Now ξ v+1 is RCF reduced and the RCF expansion is purely periodic. There are two cases: (i) p > q. Lemma of [, p. 106] dealt with this case. The period begins and ends with an odd number k of unit partial quotients and hence m = k, with k odd. (ii) p < q. The proof also shows that the period begins and ends with an even number k of unit partial quotients and hence m = k, with k even. It follows that v = n+k.

PERIOD LENGTH EQUALITY FOR NICF AND NSCF 77 6. Connections between RCF and NSCF period lengths Ayyangar ([, p. 7]) gave a definition of NSCF reduced quadratic surd thatislessexplicitthantheoneforregularcontinuedfractions. Asurd P ν+ D Q ν is said to be special if Q ν + 1 4 Q ν+1 D and Q ν+1 + 1 4 Q ν D; it is semi reduced if it is the successor of a special surd. A reduced surd is the successor of a semi-reduced one. Ayyangar proved that a reduced surd is special ([, p. 8]) and that a quadratic surd has a purely periodic NSCF expansion if and only if it is reduced ([, p. 101-10]). We remark that a more explicit variant of the definition of NSCF reduced surd has been given by the authors in [10]. Lemma 6.1. If ξ 0 = P0+ D Q 0 is an RCF reduced quadratic surd with period length l and positive negative representations ξ j = a j + the numbers Pj+1+ D Q j+1 Q j+1 P j+1 + D = a j +1, Proof. For suppose Q j+1 P j+1 + D + j +1 + D j +1 j+1 j+1 + D,0 j l 1,,0 j,j l 1, are distinct. Q i+1 P = j+1 i+1+ D j+1 + D Qj+1, 0 i,j l 1. Then j+1 + D = 1, Q j+1 P j+1 + D + Q i+1 P i+1 + D = 1 and hence 1/ξ j+1 +1/ξ i+1 = 1. Taking conjugates gives 1/ξ j+1 +1/ξ i+1 = 1 and this contradicts that fact that ξ j+1 and ξ j+1 are negative, being reduced surds. Lemma 6.. Suppose ξ is a NSCF reduced quadratic surd. Then ξ or ξ 1 is an RCF reduced quadratic surd. Proof. By [, Corollary 1, p. 30], we have ξ > 1+ 5 and 1 < ξ < 1. So if 1 < ξ < 0, ξ is RCF reduced, as ξ > 1. If 0 < ξ, let ξ = P+ D Q. Then ξ < 1 < ξ implies 0 < Q. Also as ξ is special, we have Q < D. Then < D Q = ξ ξ < ξ. Hence 1 < ξ 1 and 1 < ξ 1 < 0, so ξ 1 is RCF reduced. Lemma 6.3. Suppose ξ 0 is NSCF reduced with NSCF and RCF period lengths k and l, respectively, where η 0 = ξ 0 or ξ 0 1 is RCF reduced. Also assume ξ 0 is not equivalent to 1+ 5. Then under the RCF to NSCF transformation of η 0, we have f(k) = l.

78 K. R. MATTHEWS AND J. P. ROBERTSON Proof. Let η 0 = [b 0,...,b l 1 ]. Then η j = ξ j for j 1. As η 0 1+ 5, we have b K > 1, for some least K 0. Then by Lemma.5, there exist m and n such that under the RCF to NSCF transformation performed on η 0, f(m) = K,f(n) = K + l. Hence η f(m) = η f(n) and η m+1 = η n+1. Also by Lemma 6.1, η m+1,..., η n are distinct. Hence n m = k, the period length of the NSCF expansion of ξ 0. Also η k = ξ k = ξ 0, i.e., η f(k) or η f(k) +1 is equal to η 0 or η 0 +1. Hence η f(k) = η 0 and f(k) = tl,t 1. However so t = 1. f(k) f(m+k) = f(n) = K +l l 1, Example 6.4. (a) ξ 0 = 35+ 31683 158 is NSCF reduced and ξ 0 1 = η 0 = [1,1,1,1,1,,3,1,1,1]. Then l = 10,k = 6,f(6) = 10 and η 0 = [1,1,1,1,1,,3,1,1,1,1,...]. (b) ξ 0 = 81+ 31683 159 is NSCF reduced and ξ 0 = η 0 = [1,1,1,1,,3,1,1,1,1]. Then l = 10,k = 6,f(6) = 10 and η 0 = [1,1,1,1,,3,1,1,1,1,1,...]. Theorem 6.5. Let L-RCF and L-NSCF be the period lengths of the RCF and NSCF expansions of ξ 0. Also let N-NSCF be the number of partial numerators ǫ i = 1 in a NSCF period of ξ 0. Then if ξ 0 is not equivalent to (1+ 5)/, (6.1) L-NSCF + N-NSCF = L-RCF. Proof. Let ξ i be the first NSCF reduced complete quotient of ξ 0. Then by Lemma 6.3, ξ i = η 0 or ξ i 1 = η 0, where η 0 = [b 0,...,b l 1 ] is an RCF reduced surd with period l. Because η 0 is equivalent to ξ 0, by Satz.4 of [1], b 0,...,b l 1 is also a period of the RCF expansion of ξ 0, so l = L-RCF. If ξ 0 is not equivalent to 1+ 5, then neither is ξ i and so by Lemma 6.3, with ξ i instead of ξ 0 and k = L-NSCF, under the RCF to NSCF transformation of η 0, we have f(k) = l. Also k = r+s and l = r+s, where r = N-NSCF and s are the number of jumps of and 1 respectively, which are made in reaching η l. Hence l = k +r and (6.1) holds. Example 6.6. ξ 0 = 16137 31683 533 = [0,1,1,1,,,1,1,1,1,1,,3,1,1,1]. Then ξ 4 = 35+ 31683 158 is the first reduced NSCF complete quotient and η 0 = ξ 4 1 = [1,1,1,1,1,,3,1,1,1]. The RCF to NSCF transformation, when applied to this period, gives [1,1,1,1,1,,3,1,1,1,1], producing the period of NSCF complete quotients ξ 5,..., ξ 10 = ξ 4. Here r = 4,s =,k = 6,l = 10.

PERIOD LENGTH EQUALITY FOR NICF AND NSCF 79 7. Equality of N-NICF and N-NSCF In this section we prove equality of period lengths L-NSCF and L-NICF. If ξ 0 is equivalent to (1+ 5)/, ξ 0 eventually has the same NSCF and NICF expansion 3 1. Hence L-NSCF = 1 = L-NICF = 1. Henceforth we 3 can assume that ξ 0 is not equivalent to (1+ 5)/. In order to prove that L-NICF = L-NSCF, it suffices by (6.1) and (1.4) to prove N-NSCF = N-NICF. By virtue of the proof of Theorem 6.5, we can assume ξ 0 = [a 0,...,a l 1 ], where ξ 0 or ξ 0 + 1 is NSCF reduced. It is convenient to determine N-NSCF by considering an RCF period a N,...,a N+l 1, where a N > 1. We require additionally that B N B N+1 > Q 0, for then if n N and Q n+1 Q n, by Lemma 3.1, we have the equivalence Q n+ < Q n+1 Θ n+1 < Θ n. We note also that in the RCF to NSCF transformation, a jump ξ i ξ i+1, where a i > 1,a i+1 > 1, produces a partial numerator 1. Hence it suffices to count the number of partial numerators 1 arising from an m unisequence: (7.1) a n,1,...,1,a n+m+1, where N n,n+m+1 N +l and a n > 1,a n+m+1 > 1. Lemma 7.1. (i) The RCF to NSCF transformation acts on an m unisequence (7.1) to produce one of the following patterns of partial numerators: (a) If m is odd, we get ǫ j+1 = = ǫ j+ m+1 = 1. t t }}}} (b) (i) If m = 4t, we get 1,..., 1,1, 1,..., 1. (ii) If m = 4t+ and Q n+t+1 < Q n+t+, t t+1 }}}} 1,..., 1,1, 1,..., 1, while if Q n+t+1 Q n+t+, we get t+1 }}}} 1,..., 1,1, 1,..., 1. (ii) If N m is the number of m unisequences occurring in a least period of the RCF expansion of ξ 0, then (7.) N-NSCF = m+1 N m. m 1 Proof. (i) Consider the RCF to NSCF transformation and assume that Q v Q v+1 for n+1 v < n+m. t

80 K. R. MATTHEWS AND J. P. ROBERTSON (7.3) (7.4) (a) If m is odd, we know from Lemma 4.1, inequalities (4.1), that and hence Θ n > Θ n+1,θ n+ > Θ n+3,...,θ n+m 1 > Θ n+m Q n+1 > Q n+,q n+3 > Q n+4,...,q n+m > Q n+m+1. So by Lemma., Q n+1 > n+1,q n+3 > n+3,...,q n+m > n+m and we get ǫ j+1 = = ǫ j+ m+1 = 1. (b) Now assume m is even, m = k. Then we know from Lemma 4.1, inequalities (4.) and (4.3), that Hence Θ n+e > Θ n+e+1 if 0 e k,e even, Θ n+f > Θ n+f+1 if k f k 1,f odd. Q n+e+1 > Q n+e+ if 0 e k,e even, Q n+f+1 > Q n+f+ if k f k 1,f odd. Case (i): Now assume k is even, k = t. Then (7.3), (7.4) give (7.5) Q n+e+1 > n+e+1 if 0 e t,e even, (7.6) Q n+f+1 > n+f+1 if t+1 f 4t 1,f odd. Also Lemma 4.1, inequality (4.4) gives Θ n+t < Θ n+t+1, so (7.7) Q n+t+1 < n+t+1. (7.8) Then inequalities (7.5) and (7.6) give ǫ j+1 = = ǫ j+t = 1 and ǫ j+t+ = = ǫ j+t+1 = 1, while (7.7) gives ǫ j+t+1 = 1. Case (ii): Assume k is odd, k = t+1. Then (7.3) and (7.4) give Q n+e+1 > n+e+1 if 0 e t,e even, (7.9) Q n+f+1 > n+f+1 if t+1 f 4t+1,f odd. (α) Assume Θ n+t < Θ n+t+1. Then (7.10) Q n+t+1 < n+t+1. Then inequalities (7.8) and (7.9) give ǫ j+1 = = ǫ j+t = 1 and ǫ j+t+ = = ǫ j+t+ = 1, while (7.10) gives ǫ j+t+1 = 1. (β) Assume Θ n+t > Θ n+t+1. Then (7.11) Q n+t+1 > n+t+1. Then (7.8) and (7.11) give ǫ j+1 = = ǫ j+t+1 = 1. Also from (4.5), if k 3, i.e., t 1, (7.1) Θ n+t+ < Θ n+t+3, so Q n+t+3 < n+t+3.

PERIOD LENGTH EQUALITY FOR NICF AND NSCF 81 Then (7.1) implies ǫ j+t+ = 1 and (7.9) implies ǫ j+t+3 = = ǫ j+t+ = 1. If k = 1, i.e., t = 0, as ǫ j+1 = 1, we must have ǫ j+ = 1, as a jump of 1 takes us from a n+m to a n+m+1. Finally, we assume Q v = Q v+1, where n+1 v < n+m. Then by Lemma 5.1, m = k and v = n+k. Case (1): If k is even, k = t, we have Q n+t = n+t and there is no change to the corresponding earlier argument. Case (): If k is odd, k = t+1, we have Q n+t+1 = n+t+1 and the corresponding earlier argument where Θ n+t > Θ n+t+1, goes over with (7.11) replaced by Q n+t+1 = n+t+1. (ii) Part (i) tells us that the RCF to NSCF transformation produces t+1 if m = t+1, (7.13) (m + 1)/ = t if m = 4t, t+1 if m = 4t+, partial numerators ǫ i = 1 and this gives (7.). Acknowledgements. We thank Jim White for pointing out the equality L-NICF = L-NSCF to the authors. We would also like to thank Alan Offer for discussions about semi regular continued fractions, for improving the continued fraction alignment and help with the graphics package pstricks. We also thank the referee for valuable suggestions that improved the exposition of the paper. References [1] A. A. K. Ayyangar, New light on Bhaskara s Chakravala or cyclic method of solving indeterminate equations of the second degree in two variables, J. Indian Math. Soc. 18 (199-30), 5 48. [] A. A. K. Ayyangar, Theory of the nearest square continued fraction, J. Mysore Univ. Sect. A. 1 (1941), 1 3, 97 117. [3] W. Bosma, Optimal continued fractions, Nederl. Akad. Wetensch. Indag. Math. 49 (1987), 353-379. [4] W. Bosma and C. Kraaikamp, Optimal approximation by continued fractions, J. Austral. Math. Soc. Ser. A 50 (1991), 481 504. [5] A. Hurwitz, Über eine besondere Art die Kettenbruch-Entwicklung reeller Grössen, Acta Math. 1 (1889), 367 405. [6] F. Koksma, Diophantische Approximation, Springer, Berlin, 1936. [7] C. Kraaikamp, A new class of continued fraction expansions, Acta Arith. 57 (1991), 1 39. [8] K. R. Matthews, Unisequences and nearest integer continued fraction midpoint criteria for Pell s equation, J. Integer Seq. 1 (009), Article 09.6.7. [9] K. R. Matthews, On the optimal continued fraction expansion of a quadratic surd, http://www.numbertheory.org/pdfs/ocf_v_nscf.pdf.

8 K. R. MATTHEWS AND J. P. ROBERTSON [10] K. R. Matthews and J. P. Robertson, On purely periodic nearest square continued fractions, J. Comb. Number Theory (010), 39 44 [11] K. R. Matthews, J. P. Robertson and J. White, Midpoint criteria for solving Pell s equation using the nearest square continued fraction, Math. Comp. 79 (010), 485 499. [1] O. Perron, Die Lehre von den Kettenbrüchen. Bd I. Elementare Kettenbrüche, Teubner Verlagsgesellschaft, Stuttgart, 1954. [13] C.-O. Selenius, Konstruktion und Theorie Halbregelmässiger Kettenbrüche mit idealer relativer Approximation, Acta Acad. Abo. Math. Phys. (1960), 77 pp. [14] B. L. van der Waerden, Pell s equation in the mathematics of the Greeks and Indians, Uspehi Mat. Nauk 31 (1976), 57 70. [15] M. J. Jacobson Jr. and H. C. Williams, Solving the Pell equation, Springer, New York, 009. [16] H. C. Williams and P. A. Buhr, Calculation of the regulator of Q( d) by use of the nearest integer continued fraction algorithm, Math. Comp. 33 (1979), 369 381. K. R. Matthews Department of Mathematics University of Queensland Brisbane, Australia, 407 and Centre for Mathematics and its Applications Australian National University Canberra, ACT, Australia, 000 E-mail: keithmatt@gmail.com J. P. Robertson Actuarial and Economic Services Division National Council on Compensation Insurance Boca Raton, 33487 USA E-mail: jpr718@gmail.com Received: 15.1.010. Revised: 6.7.010.