Håkan Lennerstad, Lars Lundberg

Similar documents
1 PYTHAGORAS THEOREM 1. Given a right angled triangle, the square of the hypotenuse is equal to the sum of the squares of the other two sides.

p-adic Egyptian Fractions

Project 6: Minigoals Towards Simplifying and Rewriting Expressions

Introduction to Olympiad Inequalities

A Study on the Properties of Rational Triangles

Part 4. Integration (with Proofs)

A Lower Bound for the Length of a Partial Transversal in a Latin Square, Revised Version

QUADRATIC EQUATION. Contents

6.5 Improper integrals

Farey Fractions. Rickard Fernström. U.U.D.M. Project Report 2017:24. Department of Mathematics Uppsala University

Discrete Structures Lecture 11

Algorithms & Data Structures Homework 8 HS 18 Exercise Class (Room & TA): Submitted by: Peer Feedback by: Points:

#A42 INTEGERS 11 (2011) ON THE CONDITIONED BINOMIAL COEFFICIENTS

Technische Universität München Winter term 2009/10 I7 Prof. J. Esparza / J. Křetínský / M. Luttenberger 11. Februar Solution

Probability. b a b. a b 32.

AP Calculus BC Chapter 8: Integration Techniques, L Hopital s Rule and Improper Integrals

NON-DETERMINISTIC FSA

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER MACHINES AND THEIR LANGUAGES ANSWERS

Chapter 3. Vector Spaces. 3.1 Images and Image Arithmetic

Linear Algebra Introduction

PAIR OF LINEAR EQUATIONS IN TWO VARIABLES

Matrices SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics (c) 1. Definition of a Matrix

CS 573 Automata Theory and Formal Languages

Arrow s Impossibility Theorem

Counting Paths Between Vertices. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs

Intermediate Math Circles Wednesday 17 October 2012 Geometry II: Side Lengths

(a) A partition P of [a, b] is a finite subset of [a, b] containing a and b. If Q is another partition and P Q, then Q is a refinement of P.

Comparing the Pre-image and Image of a Dilation

CS 491G Combinatorial Optimization Lecture Notes

5. Every rational number have either terminating or repeating (recurring) decimal representation.

Discrete Structures, Test 2 Monday, March 28, 2016 SOLUTIONS, VERSION α

Lecture Notes No. 10

Hyers-Ulam stability of Pielou logistic difference equation

I1 = I2 I1 = I2 + I3 I1 + I2 = I3 + I4 I 3

Chapter 4 State-Space Planning

T b a(f) [f ] +. P b a(f) = Conclude that if f is in AC then it is the difference of two monotone absolutely continuous functions.

April 8, 2017 Math 9. Geometry. Solving vector problems. Problem. Prove that if vectors and satisfy, then.

Chapter 8 Roots and Radicals

For a, b, c, d positive if a b and. ac bd. Reciprocal relations for a and b positive. If a > b then a ab > b. then

Algorithm Design and Analysis

Section 1.3 Triangles

Algorithm Design and Analysis

Arrow s Impossibility Theorem

More Properties of the Riemann Integral

2.4 Theoretical Foundations

CHENG Chun Chor Litwin The Hong Kong Institute of Education

Line Integrals and Entire Functions

Bases for Vector Spaces

where the box contains a finite number of gates from the given collection. Examples of gates that are commonly used are the following: a b

TOPIC: LINEAR ALGEBRA MATRICES

ILLUSTRATING THE EXTENSION OF A SPECIAL PROPERTY OF CUBIC POLYNOMIALS TO NTH DEGREE POLYNOMIALS

Convert the NFA into DFA

Maintaining Mathematical Proficiency

ANALYSIS AND MODELLING OF RAINFALL EVENTS

Lecture 3: Equivalence Relations

22: Union Find. CS 473u - Algorithms - Spring April 14, We want to maintain a collection of sets, under the operations of:

( ) { } [ ] { } [ ) { } ( ] { }

THE PYTHAGOREAN THEOREM

Necessary and sucient conditions for some two. Abstract. Further we show that the necessary conditions for the existence of an OD(44 s 1 s 2 )

The Word Problem in Quandles

GM1 Consolidation Worksheet

Nondeterministic Finite Automata

= state, a = reading and q j

Lecture Summaries for Multivariable Integral Calculus M52B

Symmetrical Components 1

Lecture 6: Coding theory

CS311 Computational Structures Regular Languages and Regular Grammars. Lecture 6

Finite State Automata and Determinisation

On Implicative and Strong Implicative Filters of Lattice Wajsberg Algebras

Tutorial Worksheet. 1. Find all solutions to the linear system by following the given steps. x + 2y + 3z = 2 2x + 3y + z = 4.

03. Early Greeks & Aristotle

Lesson 2: The Pythagorean Theorem and Similar Triangles. A Brief Review of the Pythagorean Theorem.

This enables us to also express rational numbers other than natural numbers, for example:

Minimal DFA. minimal DFA for L starting from any other

Fast index for approximate string matching

12.4 Similarity in Right Triangles

1.3 SCALARS AND VECTORS

Activities. 4.1 Pythagoras' Theorem 4.2 Spirals 4.3 Clinometers 4.4 Radar 4.5 Posting Parcels 4.6 Interlocking Pipes 4.7 Sine Rule Notes and Solutions

The Regulated and Riemann Integrals

INTEGRATION. 1 Integrals of Complex Valued functions of a REAL variable

University of Sioux Falls. MAT204/205 Calculus I/II

Math 32B Discussion Session Week 8 Notes February 28 and March 2, f(b) f(a) = f (t)dt (1)

Section 4.4. Green s Theorem

Lecture 3 ( ) (translated and slightly adapted from lecture notes by Martin Klazar)

1B40 Practical Skills

SECTION A STUDENT MATERIAL. Part 1. What and Why.?

2.4 Linear Inequalities and Interval Notation

Section 6.1 Definite Integral

8 THREE PHASE A.C. CIRCUITS

CIT 596 Theory of Computation 1. Graphs and Digraphs

Numbers and indices. 1.1 Fractions. GCSE C Example 1. Handy hint. Key point

Nondeterministic Automata vs Deterministic Automata

Logic Synthesis and Verification

CM10196 Topic 4: Functions and Relations

HS Pre-Algebra Notes Unit 9: Roots, Real Numbers and The Pythagorean Theorem

arxiv: v1 [math.ca] 21 Aug 2018

are coplanar. ˆ ˆ ˆ and iˆ

Proving the Pythagorean Theorem

Computational Biology Lecture 18: Genome rearrangements, finding maximal matches Saad Mneimneh

Now we must transform the original model so we can use the new parameters. = S max. Recruits

Transcription:

GENERALIZATIONS OF THE FLOOR AND CEILING FUNCTIONS USING THE STERN-BROCOT TREE Håkn Lennerstd, Lrs Lunderg Blekinge Institute of Tehnology Reserh report No. 2006:02

Generliztions of the floor nd eiling funtions using the Stern-Broot tree Håkn Lennerstd, Lrs Lunderg Shool of Engineering, Blekinge Institute of Tehnology, S-371 79 Krlskron, Sweden {Hkn.Lennerstd, Lrs.Lunderg}@th.se Astrt We onsider fundmentl numer theoreti prolem where prtil pplitions ound. We deompose ny rtionl numer in rtios s evenly s possile while mintining the sum of numertors nd the sum of denomintors. The minimum nd mximum of the rtios give rtionl estimtes of from elow nd from ove. The se = gives the usul floor nd eiling funtions. We furthermore define the differene, whihiszeroiff GCD(, ), quntifying the distne to reltive primlity. A min tool for investigting the properties of, nd is the Stern-Broot tree, where ll positive rtionl numers our in lowest terms nd in size order. We prove si properties suh tht there is unique deomposition tht gives oth nd. It turns out tht this deomposition ontins t most three distint rtios. The prolem hs risen in generliztion of the 4/3 onjeture in omputer siene. Keywords: Floor funtion, eiling funtion, medint, reltive primlity, Stern-Broot tree. 1 Introdution In this pper we study optiml wys to deompose rtionl numer in rtios, while preserving the sum of numertors nd the sum of denomintors. This is done so tht ll rtios re s lose s possile to. We re interested in the minimum, mximum of the rtios, nd of the differene of these two numers. The prolem is fundmentl numer theoreti prolem, nd hs very prtil implitions. However, the prolem hs risen in omputer siene ontext. The min results in the present pper re importnt in the ompnion pper [7], whih otherwise is independent. In tht pper generl version of the 4/3-onjeture, well known in omputer siene, is solved. 1

The present pper is purely mthemtil. Here we tke dvntge of the Stern-Broot tree to prove the existene of optiml deompositions in rtios, nd to find these deompositions. Given three integers, nd where 1, we onsider sets of quotients 1,..., so tht = P 1 i nd = P 1 i. Here ll i re integers nd ll i re positive integers, i.e. 1 i for ll i. Suh set is lled -deomposition of 1.Pik-deomposition where min(,..., ) is mximl. For suh deomposition we denote =min( 1,..., ). We ll the - floor rtio of nd. This term is motivted y the ft tht we hve = nd =, so the quntity generlizes the floor funtion. We refrin from writing with frtion r, s j k,sine d d 6= in generl. We my similrly define generlized eiling funtion. For deomposition 1,..., where mx( 1,..., ) is miniml, we denote =mx( 1,..., ), whih is the -eiling rtio of nd. We prove tht there is deomposition fulfilling oth the minimum nd the mximum, i.e. where =min( 1,..., ) nd =mx(1,..., ) (Lemm 18). We furthermore define the eiling-floor differene s h i l m j k =. We hve =0if nd only if GCD(, ), sine only if GCD(, ) there re deompositions so tht ll rtios re equl. If is not multiple of the differene inreses from 0 to 1 when inreses from 1 to. The quntity quntifies the distne to divisiility of y, where n e seen s h i rudeness prmeter. This is refleted in the property d d = d/de (Lemm 11). The differene hs prtil interprettions. One is the "unvoidle unfirness" if ojets re shred mong persons who re sudivided in groups (see Setion 4). The sequenes of floor or eiling rtios my e denoted without index, i.e. j k ³j k j k =,...,, nd l m ³l m l m =,...,. The sequene is deresing from to s funtion of, while is inresing from to. We here use the terms "inresing" nd "deresing" in the forms tht llow equlity e.g. f(x) is inresing if f(x) f(y) for ll x<y. The prmeter speifies the numer of rtios in whih to divide, slightly similrly to how the denomintor in speifies the numer of prts in whih to divide. The notion of s n "extr denomintor" of speil kind is 2

supported y tht the revition formul d d = n e generlized to lso inlude, sinewehve ¹ º d j k» ¼ d l m d h i =, =, nd = d d d d d d for ny positive integer d (Lemm 12). It is however more to the point to desrie sthedegreeofrudenessinhowweestimte, lterntively to regrd +1 s the degree of ury. This is nturl sine =1give mximl ury, 1 = =, while it is miniml for = whereweget the floor nd eiling funtions = nd = 1. In this pper we give si properties of nd nd show how the - floor nd -eiling rtios effetively my e lulted y using the Stern-Broot tree. The min referene for the Stern-Broot tree is [4]. In this tree ll positive rtionl numers re generted extly one, nd ll our in shortest terms. The link etween the -floor nd -eiling rtios nd the Stern-Broot tree is provided y the opertion 1 2 2 = 1 + 2 + 2, here denoted y. Thenumer 1+ 2 + 2 is lled the medint of 1 nd 2 2. It is the min opertion of onstrution of the Stern-Broot tree, nd expresses tht the sums of numertors nd denomintors re preserved in deomposition. In Setion 4 pplitions in numer theory nd disrete liner lger re desried riefly. The opertion hs nturl prtil pplitions. Consider sitution wherewehve 1 kg of ertin gs in ontiner of volume litres, with density 1 /, nd similrly for 2 kg of ertin gs in neighouring ontiner of volume 2 litres. If the ontiners re merged, for exmple y removing wll etween the ontiners, we get the density ( 1 + 2 )/( 2 + 2 ) in the lrger merged volume. This instne hs ovious disrete ounterprts if 1, 2, 2 nd 2 re ll integers. In this pper we re interested in the inverse medint opertion, mening tht we will go kwrds in the Stern-Broot tree. Given two numers nd, we wnt to find deomposition with 1... =. We re interested in deomposition tht is uniform, i.e., the rtios 1,..., should e s equl s possile. This prolem is trivil for ontinous sets of numers, in whih se ll rtios n e tken to e equl. It is not trivil if i Z nd i Z + for ll i, nd the differene = quntifies the distne to n even distriution. For disrete sets we thus define: Definition 1 Assume tht Z nd Z +. A deomposition = 1... is uniformfromelowif there is no other deomposition with lrger min( 1,..., ). Similrly, it is uniformfromoveif there is no other deomposition with smller mx( 1,..., ). It is uniform if it hs oth properties. 3

It turns out tht for ny there exist uniform prtition. Furthermore it is unique nd ontins t most three distint rtios (Lemm 18). The Stern- Broot tree lso provides fst lgorithm to lulte the numers nd. The pper is orgnized s follows. In Setion 2 we present si properties of the medint nd of the Stern-Broot tree, onluding with previous reserh. In Setion 3 we present nd prove si properties of the -floor nd the -eiling rtios, nd the eiling-floor differene. In Setion 4 few pplitions of these funtions re disussed. 2 The medint nd the Stern-Broot tree 2.1 Previous reserh 2.1.1 Numer theory nd the Stern-Broot grph Moritz Arhm Stern (1807 1894) sueeded Crl Friedrih Guss in Göttingen. In 1858 he pulished the rtile Üer eine zhlentheoretishe Funktion [8], whih ontins the first pulition of tree whih lter me to e known s the Stern-Broot tree. Independently, the lokmker Ahille Broot 1861 presented the sme tree in pper out effiient use of systems of ogwheels [2]. Thus, from the very eginning the numer theoreti ontent of the tree ws ompgnied y pplitions, similrly to how this pper hs emerged from prolems in the omputer siene ompnion pper [7] (see Setion 4). The Stern-Broot tree ws reintrodued y R. Grhm, D. Knuth nd O. Ptsnik in [4], nd hs sine then een the sujet of reserh. For exmple, in [6] M. Niqui devises lgoritms for ext lgorithms for rtionl nd rel numers sed on the Stern-Broot tree. 2.1.2 Computer siene Computer siene prolems re often very lose to pure omintoril or numer theoreti prolems. In well-known inpking prolem we hve n positive numers x =(x 1,..., x n ) nd wnt to find prtition A of these numers in k sets A 1,..., A k, k<n,so tht f(a, x) =mx 1 j k ( P i A j x i ) is miniml. We my denote this minimum y f(x) e =min A f(a, x) In the 4/3-onjeture two ses of inpking re ompred in the se k =2. Norml inpking, s ove, is ompred to ounterprt with n extrliertyduringthepking. Hereoneofthenumersx i my e split in two positive numers x i,1 nd x i,2 whose sum is x i. We denote y f 0 (A, x) = min split xi (mx 1 j k ( P i A j x i )) nd f e0 (x) =min A f 0 (A, x). It is trivil tht min x (f/f 0 )=1. The 4/3-onjeture sttes tht mx x (f/f 0 )=4/3. This sttement ws onjetured y Liu 1972 [5] nd proved y Coffmn nd Grey 1993 [3], ll in omputer siene ontext. 4

In omputer siene ontext, set of numers (x 1,..., x n ) my represent prllel progrm, the k prtition sets orrespond to the proessors of multiproessor with k proessors, prtition A is shedule of the prllel progrm, nd split of progrm from x i into x i,1 nd x i,2,wherex i = x i,1 + x i,2, is lled preemption. A prtition where splits re llowed is then lled preemptive shedule. Brun nd Shmidt proved 2003 formul tht ompres preemptive shedules with i preemptions to shedule with unlimited numer of preemptions in the worst se, using multiproessor with m proessors [1]. The omprison is mde in terms of the rtio of ompletion times for progrm tht mximizes this rtio, when ssuming optiml shedules in oth ses. They show tht no more thn m 1 preemptions re needed in the unlimited se. They generlized the ound 4/3 to the formul 2 2/(m/(i +1)+1), whih lso my e written s 2m/(m + i +1). The pper [7] generlizes the prolem onsidered y Brun nd Shmidt into n optiml omprison of i preemptions to j preemptions, using multiproessor with m proessors. In the se j m i 1 we find the optiml ound j/(i +1) +1 2 j/(i +1) +2. It turns outj tht ink the se j m i 1, the floor rtio provides n expliit formul: 2 i+j+1 2i+j+2. This prolem ws soure for the present min(m,i+j+1) j pper. 2.2 The medint si properties In this setion we onsider properties of the medint opertion 1 First we formulte immedite properties. It is ovious tht 1 < 1+2 + 2 < 2 2 if 1 < 2 2, unless 1 = 2 2 2 = 1+ 2 + 2. 2, in whih se 1 = 1+ 2 + 2 = 2 2. The strit inequlities re importnt for the Stern-Broot tree. The medint opertion is ssoitive, ( 1 2 2 ) 3 3 = 1 ( 2 2 3 3 ), so we my simply write 1 2 2 3 3, nd ommuttive 1 2 2 = 2 2 1. We will lso need the rule 1+d 2+d 2 2... +d = 1 2 2... + d. We ssign higher priority to thn +, so tht 1 2 2 + d is to e red ( 1 2 2 )+d. The medint n e regrded s weighted men vlue. The quntity w 1 x 1 + w 2 x 2 is the rithmeti weighted men vlue of the two numers x 1 nd x 2, where the sum of the weights w 1 nd w 2 is required to e one: w 1 + w 2 =1. The medint + +d of nd d n e thought of s weighted men vlue, s + + d = + d + d + d d, i.e, the weights w 1 = +d nd w 2 = d +d re determined y the denomintors only. We hve similrly for n numers 1... n n = +... + n 1 +... + 5 n +... + n n n.

We will use this men vlue property in Setion 3 (Lemm 17). Of ourse, when onsidering weighted men vlues, the weights w 1,..., w n re usully onsidered to e independent of x 1,..., x n. The ove remrk hs signifine s wy of more extly speify where + +d is positioned reltively to nd d. Note lso tht this men vlue is not well-defined men vlue of rtionl numers, sine d 1 d 2 2 6= 1 2 2 in generl. It is rther men vlue of pirs of numers. We remrk tht the medint opertion 1 2 2 = 1+2 + 2 is isomorfi tothe vetor ddition in liner lger: ( 1, 2 )+(, 2 )=( 1 +, 2 + 2 ). This onnetion is further disussed in Setion 4.2. 2.3 The Stern-Broot tree 2.3.1 Stern-Broot sequenes The Stern-Broot tree is generted y strting with the sequene 0 1, 1 0. Itertively, longer sequenes re generted y inserting medints in ll intermedite spes. Hene, the first Stern-Broot sequenes re S 0 = ( 0 1, 1 0 ) S 1 = ( 0 1, 1 1, 1 0 ) S 2 = ( 0 1, 1 2, 1 1, 2 1, 1 0 ) S 3 = ( 0 1, 1 3, 1 2, 2 3, 1 1, 3 2, 2 1, 3 1, 1 0 ) S 4 = ( 0 1, 1 4, 1 3, 2 5, 1 2, 3 5, 2 3, 3 4, 1 1, 4 3, 3 2, 5 3, 2 1, 5 2, 3 1, 4 1, 1 0 ). The following figure shows the ommon wy to depit Stern-Broot tree in the literture, here inluding up to the fifth genertion. 6

Fig. 1 The Stern-Broot tree - S 5. Sine the medint is weighted men vlue, the numers re distint, nd ll sequenes S n re in inresing order. 2.3.2 Genertions If we omit numers tht re lredy generted, we n tlk out genertions of numers, whih will e importnt in this pper. The first genertions re then the following: G 0 = ( 0 1, 1 0 ) G 1 = ( 1 1 ) G 2 = ( 1 2, 2 1 ) G 3 = ( 1 3, 2 3, 3 2, 3 1 ) G 4 = ( 1 4, 2 5, 3 5, 3 4, 4 3, 5 3, 5 2, 4 1 ). Clerly, S n = n i=0 G i nd G n = S n \S n 1. We denote the genertion numer of rtio y g( ), i.e. G g( ). Eh positive rtionl numer hs unique genertion numer, this follows from tht eh rtionl numer our extly one in the tree (Theorem 2). It is ovious tht G n =2 n 1 exept tht G 0 =2, nd tht S n =2 n +1. Eh numer is medint of two numers. These two numers my y the terminology of grph theory e lled prents. Sine every seond numer in 7

Stern-Broot sequene is generted in the lst step, nd ll other numers in erlier steps, eh numer hs one prent tht elong to the previous genertion nd nother tht elongs to n erlier genertion. The numer 1 1 is the only exeption to this. We ll prent in the previous genertion the lose prent, nd the other prent the distnt prent. 2.3.3 The tree nd the grph When depiting the Stern-Broot tree in the literture, it is trdition to denote thetreeinsimplified nd somewht inorret wy. Edges to lose prents re represented only. When disregrding the other edges, the Stern-Broot tree is inry tree, exept for the genertion onsisting of 0 1 nd 1 0. When tking oth kinds of edges into ount, the grph is not tree, if it is regrded s n undireted grph. For the results in this pper we need oth kinds of edges. In the following figure the distnt prent-offspring edges re mrked with dotted line. Fig 2 The Stern-Broot grph up to fifth genertion S 5 = 5 i=0 G i. When we expiitely need oth kinds of edges, we will tlk out the Stern- Broot grph. We then regrd the grph s direted grph where the edges re direted from lower to higher genertions. As direted grph it is tree sine there re no yles. We use the term Stern-Broot grph to emphsize tht oth kinds of egdes re eqully importnt. In the following rgument, we exempt the nodes 0 1 nd 1 0. Considering lose edges only, eh node hs one prent nd two offsprings. Considering ll edges, eh node hs two prents nd n infinite numer of offsprings, two in eh higher genertion. The grph is infinitely lrge, lterntively suffiiently lrge. 8

We furthermore remrk tht the size order mong the entries from left to right is lwys preserved. Geometrilly this mens tht the grph is plnr grph the rnhes do not ross. The rnhes do not even shdow eh other if we imgine the sun ove the tree positioned in zenit. 2.3.4 Stern-Broot pirs Nodes tht re o-prents, i.e. hs ommon offspring, ply n importnt role in this pper. A pir of rtionl numers tht re prents to is lled the Stern-Broot pir of, nd is denoted y SB( ). By the onstrution, eh rtio 1 hs unique pir of prents. Note tht (, 2 2 ) = SB( ) implies 1 2 2 =, ut the onverse implition is usully flse. For exmple, ( 2 5, 3 7 ) 5 is the Stern-Broot pir of 12,ut( 1 5, 4 7 ) is not, lthough 1 5 4 7 = 5 12. We write the pir in size order, so if ( 1, 2 2 ) is Stern-Broot pir we know tht 1 < 2 2. The signifine of Stern-Broot pirs is tht it provides deomposition where the numers re s lose s possile to the deomposed numer. Note tht if ( 1, 2 2 ) is Stern-Broot pir there re no rtios in lowest terms in the intervl ( 1, 2 2 ) tht hve denomintor smller thn + 2. Exept for the Stern-Broot pir ( 0 1, 1 0 ), the two memers of Stern-Broot pir lwys elong to different genertions. Eh Stern-Broot pir ( 1, 2 2 ) defines n infinite rnh in the tree y repeted medint-ddition of the element tht elongs to the lower genertion. If g( 1 ) >g( 2 2 ) the rnh runs to the right immeditely elow the element 2 2 : B R ( 2 2 )={ 1 + n 2 + n 2,n=0, 1, 2,...}, while if g( 1 ) <g( 2 2 ) it goes to the left elow the rtio 1 : B L ( 1 )={ n 1 + 2 n + 2,n=0, 1, 2,...}, Note tht B R ( 2 2 ) goes to the right ut ppers to the left of 2 2, nd nlogously for B L (see Fig 3). For exmple, the first two rnhes in the tree re B L ( 0 1 ) nd B L ( 1 0 ), where B L( 0 1 ) onsist of ll rtios where the numertor is 1, { 1 n,n N}, while B R ( 1 0 ) is the set of nturl numers N ={1, 2, 3,...}. The next two rnhes re B R ( 1 1 )={ n n+1,n N} nd B L( 1 n+1 1 )={ n,n N}. Let us onsider ertin node in the tree s distnt prent. Then ll lose o-prents to tht node re loted in the two rnhes elow. Thus, the set of ll o-prents to in higher genertions is C( )=B L( ) B R( ).Ofourse, the two rnhes never interset. 9

Fig 3 Brnhes B L ( 1 2 ) nd B R( 1 2 ) elow 1 2. 2.3.5 Anhestor sequenes We use the term nestor sequene A( ) to rtio for the sequene ontining ll prents, prent s prents, nd so on, in size order. The rtio itself is inluded in the nhestor sequene. We only inlude one of the nhestors 0 1 nd 1 0. If 1 the nhestor 0 1 is inluded, otherwise 1 0 is inluded. It follows from the onstrution tht the nhestor sequene ontins extly one memer for eh genertion from 0 to g( ). The nhestor sequene A( ) is susequene to S(g( )), nd forms onelike set in the Stern-Broot tree. For exmple, the nhestor sequene of 2 5 is A( 2 5 )=(0 1, 1 3, 2 5, 1 2, 1 1 ). 10

Fig 4 A( 5 8 ) nhestorsetof 5 8 inside doule lines. As we shll see, the numers in A( ) re the numers tht our in the sequenes nd. The floor sequene onsists of nd the numers in A( ) to the left of, while the eiling sequene onsists of nd those to the right. In Setion 3 we prove this nd speify exly how is relted to the memers in the set A( ). We sometimes use the term nhestor set, insted of nhestor sequene, if the order is irrelevnt 2.3.6 Proofs of si properties of the Stern-Broot tree We next estlish fundmentl properties of the Stern-Broot tree. The proofs follow those in [4]. Theorem 2 Eh non-negtive rtionl numer ours extly one in the Stern- Broot tree, nd in lowest terms. Proof : No numer n our twie or more, sine seond ourene in Stern-Broot sequene would violte the strit inresing order of numers. We next show tht ll numers in the tree re in lowest terms. Of ourse, the rtio l L is in lowest terms if there re integers nd so tht l + L =1. We show y indution tht we hve Lr lr =1if l L, r R re djent numers in ny Stern-Broot sequene. From this it follows tht oth l L nd r R re in lowest terms. 11

It is ler tht the pir 0 1, 1 0 fulfil the ondition Lr lr =1. For the indution it is enough to show tht if we hve Lr lr =1,thenL(l + r) l(l + R) =1 is lso true. This is trivil lultion. Finlly we prove tht ny rtio 0, where nd re reltively prime, ppers in the Stern-Broot tree. For this we use the nturl inry serh lgorithm in the tree, strting with ( 0 1, 1 0 ), where we in eh step pik the intervl ( l L, l+r l+r L+R ) or ( L+R, r R ) tht ontins l+r. A third possiility is L+R =, in whih se we hve found the pperene of in the tree. We need to show tht this third se neessrily hppens t some point during the serh lgorithm. We will show tht from the inequlities l L < < r R nd Lr lr =1it follows tht l + L + r + R +. Sine t lest one of the numers l, L, r nd R inrese y t lest one in eh step of the itertion, while nd re onstnts, the inequlities l L < < r R nnot e vlid for n infinite numer of steps. Hene, the third se l+r L+R = neessrily hppens. In proving l + L + r + R +, we strt y noting tht the inequlities l L < < r R give L l 1 nd r R 1. If these inequlities re multiplied y r + R respetive l + L we get (L l)(r + R) r + R, (r R)(l + L) l + L. Addition of the inequlities nd nelltion to the left gives so from Lr lr =1we get The theorem is proved. (Lr Rl)+( lr + rl) l + L + r + R, + l + L + r + R. In order to desrie how rpidly the rtios grows in the tree, it is well known tht the denomintors of the numers x G n,x<1 re t lest n nd t most F n. Here F n is the n:th memer in the Fioni sequene 1, 1, 2, 3, 5, 8, 13,..., defined itertively y F n+2 = F n+1 + F n nd F 0 =1,F 1 =1. Furthermore, the Stern-Broot tree gives the est possile rtionl pproximtions of n irrtionl numer. We my extend the definition of n nhestor set to n irrtionl numer q, y itertively piking n intervl ( 1, 2 2 ) to whih q elongs s in the proofs of Theorem 2, giving n infinite nhestor set A(q). The set ontins the est rtionl pproximtions of q with limited denomintor: Theorem 3 Suppose tht q>0is irrtionl. If / A(q) nd q<, then there is rtio d A(q) so tht d nd q< d <. Similrly, if / A(q) nd q>, then there is rtio d A(q) so tht d nd < d <q. 12

For proof, see [4]. For exmple, the nhestor set of the golden men φ = ( 5+1)/2 1.61803... is A(φ) ={ 1 0 } {F n/f n 1,n N}. Thus, rtios of Fioni numers give est possile rtionl pproximtions of φ. We remrk tht F n n expliitly e lulted using φ s F n =(φ n ( φ) n / 5. We onlude this setion y ontriuting to the knowledge out the Stern- Broot grph with grph theoreti oservtion. We here study the Stern- Broot grph nd not the tree oth kinds of edges re importnt. This grph isdiretedgrphwhereehedgehsdiretionfromprenttoitsoffspring. A pth from 0 0 to n n is sequene of nodes ( 0 0, 1 1, 2 2,..., n 1 n 1, n n ), where k 1 k 1 is prent to k k for ll k =1,..., n. The oservtion sys tht the numer of pths from rtio to the losest first nhestor, 0 1 or 1 0, simply is given y the denomintor of the rtio. Theorem 4 For rtio 1, the numer of distint pths in the Stern-Broot grph from 0 1 to is. Forrtio > 1, the numer of distint pths from 1 0 to is. Proof : We prove this y indution.suppose tht 1. The indution strts with the oservtions tht 1 1 hs denomintor 1 nd one single pth to 0 1, whih tkes re of the se =1, nd tht 1 2 hs denomintor 2 nd two pths to 0 1. For 1 2, there is one pth diretly from 0 1,thepth( 0 1, 1 2 ) nd one vi 1 1, whih is the pth ( 0 1, 1 1, 1 2 ). For 0 < 1, let 0 e the lose prent nd 1 the distnt prent. Thus, = 0+1 0 +. By the indution hypothesis, 0 0 hs 0 pths to 0 1 1 nd hs pths to 0 1. Now, ny pth from to 0 0 1 goes first to the lose prent 0 or to the distnt prent 1. If the distnt prent 1 is the first node, 0 0 do not elong to the pth. Hene, the set of pths strting with 0 0 is disjoint to the set of pths strting with 1. It follows tht the totl numer of pths from to 0 1 is 0 +. Sine this is the denomintor of, the theorem is proven for 1. Theproof in the se > 1 is very similr. 3 Min results 3.1 Fundmentl properties of nd We strt y proving tht for fixed nd, is deresing nd is inresing s funtions of. Lemm 5 For fixed nd, we hve for ll =1,..., 1 the inequlities +1 nd. Proof :Weprove +1. 13

+1 +1 For ny (+1)-deomposition 1,..., hs the property, +1 +1, the -deomposition 1,..., min( 1,..., +1 +1 ) min( 1,...,, +1 +1 ), sine min(, +1 +1 ) +1 +1. Perhpsitispossiletofind other -deompositions tht inrese the left side even more. Thus, for n optiml (+1)-deomposition 1,...,, +1 +1, we hve j k min( 1,..., +1 ) min( 1,...,, j +1 k )=. +1 +1 +1 By n nlogus rgument for, the lemm is proved. We next onsider the two ses of rtios tht re not represented in the Stern-Broot tree: negtive rtios nd rtios whih re not in lowest terms. 3.1.1 Positive numertors re enough By the next lemm it is enough to onsider =0,..., 1. Lemm 6 For ll Z nd Z +, we hve j k = ¹ º mod + l m =» ¼ mod + h i mod =,, nd Proof : Consider deomposition 1,...,. If we insert i = i + r i, i =1,...,, into the minimum min( 1,..., ), we otin min( 1,...,,..., + r ) = +min(r 1,..., r ). ) = min( + r 1 By summing the reltions i = i + r i, i =1,...,, it lso follows tht X r i = mod. i=1 Thus, for eh deomposition 1,...,, there is deomposition r 1,..., r with P i=1 r i = mod nd where min( 1,..., )= +min(r 1,..., r ). The two first equlitites follow y mximizing or minimizing mong the deompositions. 14

The third equlity h i mod = follows immeditely from the first two equlities nd lemm is proven. =. The This lemm seems to unrvel ertin symmetry etween the floor nd eiling funtions, sine the floor funtion ours in oth the floor nd eiling rtio sttements. This is however superfiil, nd follows from the preferene to use positive numers if possile. Perhps = d mod e + d e is more pproprite ounterprt to = + mod. In ft, the differene hs n extr symmetry, from whih if follows tht only t most d/2e vlues of give distint vlues. Lemm 7 For ll Z nd Z +, we hve h i = =. is n optiml deomposition for nd Proof : Suppose tht 1,..., ³ written in deresing order, so tht mx 1. Then mx Hene, ³ 1,..., = ¹ º» ¼ nd the lemm follows from h i,..., nd min = l m = j k. = 1 nd min ³ 1 ³ 1,..., = 1, so =, i, y Lemm 6. = h,..., = It is furthermore enough to onsider deompositions whith rtios in the losed intervl (, d e). ³ Lemm 8 There is deomposition 1,..., where i i [, d e] for i = ³ 1,..., where mx 1,..., =.There is lso suh deomposition where ³ min 1,..., =. 15

³ Proof : Consider 1,...,, where 1 is the smllest rtio nd is the ³ lrgest, nd tht 1 <. Then the deomposition 1,..., n e repled ³ y 1+1,..., 1, where the minimum nnot e smller nd the mximum nnot e lrger. By repeting this rgument, the lemm is proven. 3.1.2 / notinlowestterms We next tke re of the se when / is not in lowest terms. First we single out the trivil ses. The most trivil se is when is multiple of. Lemm 9 If = n for some integer n, then = = n for ll 1. Proof :Sine = n, the deomposition ( n( +1) +1, n 1,..., n 1 ) is est possile for ny. In the next lemm, nd my hve ommon divisor. We denote y GCD(, ) the gretest ommon divisor of nd. Lemm 10 Suppose tht d = GCD(, ). Then = = if nd only if d. Also, =0if nd only if GCD(, ). Proof :Denote = d 0 nd = d 0. Here the deomposition ( 0(d +1) 0 (d +1), 0 0,..., 0 0 ), where ll rtios re equl, is possile if nd only if d +1 1. The lemm follows. Our finl nd exhustive result when nd hve ommon ftor is the following. j k d d =, d/de Lemm 11 Suppose tht d is positive integer. Then l m d d = h i d/de nd d d = d/de. The lemm llows us to lwys onsider rtios in lowest terms. In this lemm the eiling funtion in the index is genuin it nnot nturlly e repled y floor funtion. Lemm 11 is very nturl if we onsider - deomposition in d susets, where we in eh suset deompose the rtio /d /d in prllel. There does not exist etter deompositions thn this, whih follows y Lemm 17. Next we generlize the revition formul d d = d to lso inlude : Lemm 12 If is n integer nd nd repositiveintegerswehve ¹ º d j k» ¼ d l m d h i =, =, nd = d d d The lemm follows y repling y d in Lemm 11. d d 16

3.2 Connetion to the Stern-Broot tree Next we relte the quntities, nd to the Stern-Broot tree. We onsider the sequene of the two prents ( l L, r R ) to, i.e. ( l L, r R )=SB( ) s defined y the Stern-Broot tree (see Setion 2.3.4). We sy tht the replement of y SB( ) is prtition. A prtition sequene P ( ) is sequene written in inresing order onsisting of rtios. The sequene P ( ) is onstruted from P 1 ( ) y prtitioning the ouring rtio tht elongs to the ltest genertion. Sine only rtios in the nhestor sequene of ppers, where ll rtios elong to different genertions, this proedure is well-defined. The proess strts with P 1 ( )=( ), followed y P 2( )=( l L, r R ). The next step depends on whether g( l L ) or g( r R ) is lrgest. It is ovious tht P ( ) ontins rtios nd is -deomposition of. We will find tht it is uniform deomposition (Lemm 17), in ft the unique suh, nd thus importnt for lulting, nd. Considered s set we hve P ( ) A( ), ut s sequenes we my hve = P ( ) > A( ) = g( )+1 sine P ( ) my hve mny repeted rtios, nd possily >g( )+1.Inft,P ( ) hs lwys very few distint rtios. Lemm 13 P ( ) ontins t most three distint rtios. Proof : The rtio t the highest genertion is prtitioned into its prents, mny times if it ours repetedly. This give rise to multiple versions of the two prents only, nd no other rtios. Hene these three rtios re the only ouring distint rtios. At the step when the lst rtio is prtitioned, there is extly two distint rtios. Only P 1 ( ) ontins one single distint rtio. The lemm is proved. Thus: the prtition sequenes re susets of the nhestor set tht usully hve mny repeted elements, uilded y the lgorithm from elow in the tree nd upwrds. Our next im is Theorem 16, tht onnets the Stern-Broot tree to deompositions of. In Setion 2.3.5 we defined Stern-Broot pir of rtio 0 0, denoted y SB( 0 0 ), s pir ( 1, 2 2 ) reltedinthtthetwortios 1 re 2 2 re the prents to 0 0 in the Stern-Broot tree. We denote the gretest ommon divisor of nd s GCD(, ). Thus, GCD(, ) =1iff 1 is in lowest terms. Given pir (, 2 2 ) with 1 2 2 = 0 0, we next define the Stern-Broot opertion SBO( 1, 2 2 ). This opertion mps the pir ( 1, 2 2 ) onto nother pir, whih either is Stern-Broot pir or two equl rtios. It is defined s follows: SBO( 1, 2 2 )= ( SB( 1 2 2 ) if GCD( 0, 0 )=1 ( 0 0, (d 1) 0 (d 1) 0 ) if GCD( 0, 0 )=d>1 We mentioned erlier tht ( 2 5, 3 7 ) is Stern-Broot pir, ut ( 1 5, 4 7 ) is not, lthough 1 5 4 7 = 5 12. The Stern-Broot opertion reples ( 1 5, 4 7 ) y ( 2 5, 3 7 ), so SBO( 1 5, 4 7 )=(2 5, 3 7 ). 17

Of ourse, the Stern-Broot opertion leves Stern-Broot pirs unhnged. Otherwise, the new pir is loser together. This is lso the se if the rtio is not in lowest terms. This is the ontent of the following lemm, nd the signifine of the Stern-Broot opertion. Lemm 14 If 1 < 2 2 nd SBO( 1 2 2 > A 2 B 2, or ( 1, 2 2 )=( A 1 B 1, A 2 B 2 )., 2 2 )=( A 1 B 1, A 2 B 2 ), then either 1 < A 1 B 1 Proof :IntheseGCD( 0, 0 ) > 1 the lemm is trivil. If GCD( 0, 0 )=1, we firstremrkthtif 1 = A 1, then lso 2 = A 2 follows from = 1 + 2 = A 1 + A 2, nd similrly for the denomintors. So if 1 = A1 B 1, then lso 2 2 = A2 B 2. If GCD( 0, 0 )=1, oth the inequlities 1 > A1 B 1 nd 2 2 < A2 B 2 re impossile sine y the onstrution of the Stern Broot tree there re no rtionl numers in the intervl ( A 1 B 1, A 2 B 2 ) exept suh tht hs denomintor + 2 = B 1 +B 2 or lrger. The lemm is proved. We next use the Stern-Broot opertion to suessively modify deomposition D into D 0 y repling pir ( 1, 2 2 ) in D y SBO( 1, 2 2 ). A deomposition where the Stern-Broot opertion hs no effet on ny possile pir in the deomposition is lled n invrint deomposition. ³ Lemm 15 Any -deomposition D ( )= 1,..., of, ninfinite numer of steps e trnsformed into n invrint deomposition D 0 y pplying the Stern-Broot opertion onseutively to ll possile pirs of rtios. Then min D min D 0 nd mx D mx D 0. Proof :Any-deomposition of onsists of rtios where the denomintors re t most +1. If ll numers re multiplied with!, we otin integers only. Now we mesure the vrition of deomposition D y the quntity V (D), whih is defined s V µ 1,..., = X i=1 2 i i!. This mesure of vrition puts n solute priority to minimizing the vritions t lrge distnes from, i.e. where i i is lrge. If lrge distne dereses nd ll lrger distnes re unhnged, V will derese, even if ll smller distnes inreses. We hve seen tht the Stern-Broot opertion either hs no effet or dereses the differene of the pir y moving oth rtios loser. This mens tht if pir ( 1, 2 2 ) in deomposition D is repled y SB( 1, 2 2 ), giving deomposition D 0, nd if SB( 1, 2 2 ) 6= ( 1, 2 2 ), then V (D 0 ) <V(D). If the Stern-Broot opertion is itertively pplied to ny strting deomposition D, the sme deomposition nnot repper, sine tht would violte tht V is deresing. The numer of deompositions is finite, from whih if nd 18

follows tht the inevitle end result of the replement proess is n invrint deomposition. The lemm is proved. In n invrint deomposition, ll pirs re Stern-Broot pirs, i.e. ommon prents to ertin rtio. The topology of the Stern-Broot tree llows only very simple suh deompositions. Theorem 16 If >1 there exist only invrint deompositions with two or three distint elements. The following figure depits the two possile onfigurtions, with two nd with three elements. Figure: Invrint Stern-Broot deompositions of two nd of three memers. Proof : If n invrint deomposition hs two distint elements only, it ontins two elements tht re prents to third element, whih is not prt of the deomposition. Eh element hs one distnt prent nd one lose prent. If we fix distnt prent A, whih my pper in ny lotion in the Stern-Broot tree, s desried in Setion 2.3.4, ll possile lose o-prents to A re loted in the two rnhes B L (A) or B R (A) elow A. Any seond prent B on these two rnhes form n invrint deomposition with two distint elements. The ommon desendnt of A nd B isthenextnodeonthesmernhsb. In the se ot three distint elements we hve to onsider how to dd third element C to the two existing prents A nd B, sothtc is prent together with oth A nd B. If C is distnt prent together with A, then it nnot e o-prent with B. Therefore, C hs to elong to one of the two o-prent rnhes B L (A) or B R (A). In order to e o-prent lso to B, there re only two possile lotions for C: immeditely ove or immeditely elow B, on thesmernh. We next onsider if n invrint deomposition is possile with four elements. We then try to dd one fourth element D to the three existing, A, B nd C. Agin, if D is distnt prent with A, thenitnnoteo-prentwithb or C. So the o-prenthood with A requires tht D is loted on one of the two rnhes elow A. Similrly it hs to e next to B or C on the sme rnh in order to o-prent with one of them. But then it will neessrily not e o-prent with the remining element on the sme rnh, C or B, towhihit is not djent. Hene there is no invrint deomposition with four elements. When onsidering invrint deompositions of five or more elements, we note tht eh suset of four element need to e n invrint deomposition in iteself. Sine this is impossile, there does not exist n invrint deomposition of four or more distint elements. The proof is omplete. Note tht we hve not yet ruled out the possiility tht there my e severl different invrint deompositions, one of whih is uniform from ove nd one from elow. By the next lemm there is only one invrint deomposition, nd it is P ( ), whih is defined y simple suessive prtition lgorithm. 19

Lemm 17 P ( ) is n invrint deomposition of, nd unique uniform -deomposition of. Proof : P ( ) is generted y suessively prtitioning the element of the highest genertion. The two elements tht result from suh prtition re thus o-prents. The other two possile pirs re lso o-prents. This follows from the ft tht one Stern-Broot sequene is generted from the previous y dding offsprings in the intermedite spes etween two elements, where one is n offspring of the other. Hene, in terms of the onventionl grph terminology pplied to the Sterm-Broot tree, we hve tht n offspring nd the lose prent re lwys o-prents to nother offspring. It remins to prove tht there n e no other invrint deomposition thn P ( ) tht lso is uniform deomposition. Suppose tht P ( ) hs the two distint memers 1 nd 2 2 nd 1 < 2 2. Then we n write in two lterntive wys, where the lst one is in terms of weighted men vlues: 1... 1.. 2... 2 = {z 1 } 2 {z 2 } 1 2 1 2 2 1 + 2 = + 2 + 2 2, where 1 + 2 =. Suppose furthermore tht g( 1 ) <g( 2 2 ),so 2 2 is on rnh B L ( 1 ) elow 1. Cn we move 2 2 on tht rnh nd reh different -deomposition of? If we reple ny of the 2 2 :s with rtios to the left on the sme rnh, we would djust the men vlue to the left. In order to mintin the men vlue nd keep proper deomposition of, we would e required to reple ny or some of the 1 1 :s y ny of the rtios on the rnh. But ll these hnges would derese the denomintors of the rtios, so their sum nnot still e. Ifwetrytoreplenyofthe 2 2 :s with rtios to the right on the sme rnh, we would djust the men vlue to the right, nd would need to ompenste this y inresing the numer of 1 y replements. These hnges would ll inrese the sum of denomintors, so in this wy we nnot find ny proper -deomposition. By very similr rguments we my disprove the possiility of other invrint deompositions thn P ( ) if 1 > 2 2 nd if g( 1 ) > g( 2 2 ). Conservtion of men vlue, left-right, nd denomintor sum, up-down, lso rules out ny other invrint deomposition thn P ( ) inthesethtp ( ) onsists of three distint elements. If ll rtios re moved to different rnh, either ll denomintors inrese or derese. Hene lso suh hnges re impossile. The uniqueness of P ( ) s n invrint nd uniform -deomposition follows. We remrk the onsequene tht there lwys exist one deomposition tht gives oth the minimum nd the mximum. Corollry 18 For ny Z nd, Z +, where, there is unique uniform deomposition, i.e. deomposition 1,..., so tht =min(1,..., ) nd =mx( 1,..., ). 20

We next geometrilly onstrut the sequenes nd of length, ontining nd for ll :1, respetively. To this end we split the nhestor sequene A( ) in two sequenes, the left nd right nhestor sequenes, denoted A L ( ) nd A R( ). Define n s the position of in A( ), i.e. A( ) n =. Now we define A L( ) nd A R( ) so tht they ontin the floor rtios nd eiling rtios respetively, nd re ordered so tht is first in the sequene. Hene: A L ( ) i = A( ) n i+1 for i = 1,..., n, nd A R ( ) i = A( ) n+i 1 for i =1,..., A( ) n +1. Theorem 19 Suppose tht is in lowest terms nd positive. Then the sequenes nd re onstruted suessively y filling the sequenes from left to right up to the length y numer of opies of eh entry of A L ( ) nd A R ( ), respetively, tken from the left. The first entry istkeninone opy. The numer of opies of ny other entry equls the numer of pths in the Stern-Broot grph from tht entry to. Proof : The set P ( ) ontins only entries from A( ). We hve to prove tht the numer of opies of n entry equls the numer of pths from tht entry to. Insted we will prove slightly different ut equivlent sttement. Note tht the numer of opies of n entry 0 0 in on of the sequenes or equls the numer of opies 0 of 0 0 tht P ( ) ontins for so tht P +1( ) is the first where 0 0 is prtitioned. This is so sine in P +1 ( ),thertio 0 0 is prtitioned one, nd then nnot e either floor or eiling rtio. However the 0 0 is floor or eiling rtio for ll P i ( ),i =0,..., 0 1, sine the prtition tht leds from P i ( ) to P i+1( ) produes one more opy of 0 0. We next show y indution tht the numer of pths from 0 0 to is 0. We first prove the initil step of the indution. The lose prent of is immeditely prtitioned, so it hs one opy oth in the floor or eiling sequene nd in P 1 ( ). The distnt prent is slightly more omplited. It my pper t ny genertion erlierthnorequltog( ) 2. However, eh prtition of the other prent gives one more opy of the distnt prent in oth the floor or eiling sequene nd in P i ( ), until the distnt prent is to e prtitioned. The generl step of the indution is similr. Suppose tht P ( ) hs the two distint memers 1, 2 2,with 1 opies of 1 nd 2 opies of 2 2, nd tht 1 < 2 2 nd g( 1 ) <g( 2 2 ). By the indution hypothesis, there exist 1 pths to 1 nd 2 pths to 2 2. Then 2 2 is prtitioned 2 times giving rise to new rtio 3 3. The edge from 2 2 to 3 3 then llows 2 pths from 3 3 to, sine there is 2 pths from 2 2 to 3. If g( 3 ) >g( 1 ) we re done. If g( 3 3 ) <g( 1 ), prtitions of 1 give 1 new opies of 3 3. This is in ordne with tht the edge from 1 to 3 3 llows 1 new pths from 3 3 to. sine there re 1 pths from 1 to 1. The prtition of gives new rtio 4 4. If g( 3 3 ) >g( 4 4 ) we re done, otherwise we n proeed with similr rgument until we re done. The proof is omplete. Artio tht my e negtive or not in lowest terms n e hndled with Theorem 19 y slight preprtions. 21

Theorem 20 For generl j,letd = k GCD(, l ), nd m denote 0 = /d nd 0 = /d. Then the sequenes 0 mod 0 0 nd 0 mod 0 0 re given y Theorem 19. Now the sequenes nd n j e onstruted k l y dding m 0 / 0 to ll entries nd dupliting eh entry of 0 mod 0 0 nd 0 mod 0 0 respetively in d opies without hnging their order. Proof : The theorem follows from Theorem 19, Lemm 6 nd Lemm 11. 3.3 Algorithms for lulting nd We next give self-ontined lgorithm for finding the vlues of nd for ny llowed omintion of integers, nd. The following theorem does not require knowledge of the proofs in the pper. In the following theorem the rrow is used s n ssignment opertor in the following three different wys: 1. If x is numer, "x y" signifies ssignment of the vlue of y to the vrile x. 2. If x is sequene, A or G, "x p y" mens insertion of the vlue y etween positions p nd p +1 in the vetor x. Thus, vlues to the right of p in the vetor x re ll juxtpositioned one step to the right, nd the length of the vetor x is inremented. 3. If x is sequene, F or C, "x (i) y" mens insertion of i opies of the vlue y fter the lst position in x. The length of the vetor thus inreses with i. The lgorithm works in two steps. First weonstrutthenhestorse- quene A( ) nd the orresponding genertion informtion G( ). In the seond lgorithm we work kwrds in the nhestor sequene to onstrut the ppropritte -vlues nd the sequenes nd, i.e. the vlues of nd for ll :1. Theorem 21 If = n for some integer n, then = = n for ll 1. Otherwise, the sequenes nd re lulted y the following two lgorithms. Algorithm 1 onstruting A( ) 1. Let d = GCD(, ). Assign /d nd /d. Also ssign mod. 2. Initilize: A =( 0 1, 1 1 ), G =(0, 1), l 0, L 1, r 1, R 1, g=2, p =2. 3. Do A p l+r L+R,G p g nd g g +1, nd go to the pproprite se 4, 4 or 4. 4. If = l+r L+R, exit the itertion, i.e. go to 5. 4. If < l+r L+R 4. If > l+r L+R, do r l + r nd R L + R, ndgoto3., do l l + r, L L + R nd p p +1 ndgoto3. 22

5. After the itertion, dd to ll vlues in A. Now the mximl vlue in G is p = g( ). Algorithm2 serhinga( ) 1. The lgorithm strts with vlues defined y Algorithm 1. Furthermore, initilize s follows: F nd C re empty sequenes, d = LGD(, ), x p 1, F (d) (d),f A(x), y= p +1,C (d), C (d) A(y), u d, v d, q p. 2. q q 1.Pik i so tht G(i) =q. 3. If q =0, exit the itertion, i.e. go to 4. 3. If i<p,f (u) A(x), x x 1, v v + u. Go to 2. 3. If i>p,c (u) A(y), y y +1,u v + u. Go to 2. 4. = F, = C. The omplexity of the lgorithm is O(). Proof : The lgorithm is n implementtion of Lemm 6, Theorem 19 nd Theorem 20. 4 Further work nd pplitions Other thn the omputer siene pplition desried in Setion 2, we here mention two futher prolem res. 4.1 Numer theory nd prtil pplitions We here limit the disussion to pplitions of the eiling-floor differene. It n e given n fundmentl pplition onerning the divisiility of numers. It n e thought of not only nswering whether two numers re divisile, ut lso, if the nswer is no, to quntify the distne to divisiility. Lemm 10 sttes tht =0if nd only if GCD(, ), ut if >GCD(, ), the numer > 0 is this quntifition. For exmple, we remrk tht i 1 = in + j n(n +1) i for ll i =2, 3,... nd for ll 1 j i 1. Thisisnotdiffiult to prove y onsidering optiml deompositions, or y studying the rnh B L ( 0 1 ) in the Stern-Broot tree. An instne of the divisiility prolem is the following: If ojets re to e distriuted mong persons, eh person otins / ojets in the men. If ojets re to e distriuted mong persons divided in groups, then the eiling-floor differene is the unviodle unfirness. It is the men mount given to eh person in the most fvoured group minus the men mount for eh person in the lest fvoured group, if the prtition is mde to minimize the unfirness. 23

One possile instne of this is if 14 persons otin 11 skets of fruit nd heese to divide mong themselves fter they hve formed 6 groups. Another is 7 divers who need to return to the surfe rpidly. They n distriute themselves mong 7 sumrines, nd hve in totl 16 tues of oxygen, whih lso need to e divided s firly s possile. Here, y the ove formul, the miniml unfirness is 1/6 gs tues. 4.2 Disrete liner lger The prolem my e reformulted into prolem for integer vetors, i.e. vetors (, ) where nd re integers, nd 1. The inverse prolem n then e reformulted s prolem of deomposing the vetor (, ) into sum of vetors ( 1, ),..., (, ) with positive y-omponents, where the diretions i / i of the omponent vetors should e s unhnged s possile ompred to the initil vetor diretion /. This formultion n nturlly e generlized from 2 to n dimensions if we let the slr produt 1 +... + n p p n 2 1 +... + 2 n 2 1 +... + 2 n mesure the diretion devine etween the integer vetors ( 1,..., n ) nd (,..., n ), generlizing ( 1, 2 ) nd (, 2 ) or 1 / 2 nd / 2. We my here ssume tht ll integers re positive. Liner lger with integer vetors hve essentil pplitions in omputer geometry. Referenes [1] Brun O., Shmidt G., Prllel Proessor Sheduling with Limited Numer of Preemptions, Sim Journl of Computing, Vol 32, No. 3 (2003), pp. 671-680. [2] Broot A., Clul des rouges pr pproximtion, nouvelle méthode, Revue Chronométrique 6 (1860), 186-194. [3] Coffmn E. G., nd Grey M. R., Proofofthe4/3onjetureforpreemptive vs. nonpreemptive two-proessor sheduling. Journl of the ACM, 40(5) (1993), 991-1018. [4] Grhm R., Knuth D., Ptshnik O., Conrete Mthemtis, Addison Wesley ISBN 0-201-14236-8 (1994). [5] Liu C. L., Optiml Sheduling on Multiproessor Computing Systems, in Proeedings of the 13th Annul Symposium on Swithing nd Automt Theory, IEEE Computer Soiety, Los Almitos, CA, (1972), pp. 155-160. [6] Niqui, M., Ext Arithmeti on the Stern Broot Tree, Tehnil Report NIII-R0325, Nijmegen Institute for Computer nd Informtion Sienes, Hollnd, (2003). 24

[7] Lunderg L., Lennerstd H., The mximum gin of inresing the numer of preemptions in multiproessor sheduling, Reserh report, Blekinge Institute of Tehnology, Sweden (2006). [8] Stern, M. A., Üer eine zhlentheoretishe Funktion. Journl für die reine und ngewndte Mthemtik 55 (1858), 193-220. 25

GENERALIZATIONS OF THE FLOOR AND CEILING FUNCTIONS USING THE STERN-BROCOT TREE Håkn Lennerstd, Lrs Lunderg Copyright 2006 y individul uthors. All rights reserved. Printed y Kserntrykeriet AB, Krlskron 2006. ISSN 1101-1581 ISRN BTH-RES 02/06 SE