Continued Fractions and Probability Estimations in Shor’s Algorithm: A Detailed and Self-Contained Treatise

: Shor’s algorithm for prime factorization is a hybrid algorithm consisting of a quantum part and a classical part. The main focus of the classical part is a continued fraction analysis. The presentation of this is often short, pointing to text books on number theory. In this contribution, we present the relevant results and proofs from the theory of continued fractions in detail (even in more detail than in text books), ﬁlling the gap to allow a complete comprehension of Shor’s algorithm. Similarly, we provide a detailed computation of the estimation of the probability that convergents will provide the period required for determining a prime factor.


Introduction
Shor's algorithm [1] for prime factorization is generally considered as a major milestone and a breakthrough in quantum computing: it solves a practically very relevant problem (which is, e.g., an underpinning of cryptography) with an exponential speedup compared to classical methods.
The algorithm is based on the fact that determining a divisor and finally a prime factor of a natural number n ∈ N can be reduced to finding the period p of the modular exponentiation function f (x) = a x modn for an a with 0 < a < n (see Section 3.2.1).
The overall algorithm is hybrid, consisting of classical computations and a quantum computation.The classical computations are computing greatest common divisors with the Euclidian algorithm, and perform a continuous fraction analysis.A detailed discussion of the latter is one of the two foci of this contribution (see Section 2).
The quantum part mainly consists of: (i) creating an entangled state based on an oracle computing the modular exponentiation function f above, (ii) performing a quantum Fourier transform (QFT) on this state, and (iii) measuring it.The oracle produces the following state: After applying the quantum Fourier transform and a measurement, the first part (i.e., the |a〉-part) of the quantum register is in state In this state, the searched period p already appears in its amplitude.The measured value y can then be used with high probability (see Section 3.4, Theorem 16) to compute the period p of the modular exponentiation function f by analyzing the convergents of a continued fraction (see Section 3.4.1)and finally, based on the period, a prime factor (see Section 3.2.1).A detailed discussion on how this is achieved is the second focus of this contribution (see Section 3).

Structure of the Article
The article is structured as follows: in Section 2 we cover all details about continued fractions that are required to comprehend the corresponding aspect of Shor's algorithm.
Section 2.1 defines the notion of a continued fraction, gives examples of how to compute the continued fraction representation of a rational number, and demonstrates how to compute the number that a continued fraction (and thus convergents) represents.
Convergents as the fundamental tool in the theory of continued fractions are detailed in Section 2.2: after defining the term, basic theorems about convergents such as the recursion theorem, two sign theorems, monotony properties, convergent comparison, nesting of a number by its convergents, and several distance estimations are proven.
Next, the brief Section 2.3 presents infinite regular continued fractions to represent non-rational numbers.A corresponding algorithm is provided to compute such continued fractions.
Section 2.4 gives several upper bounds and lower bounds for the difference between a number and its convergents.Exploiting one of these bounds, the convergence of the convergents of an infinite regular continued fraction of a number to this number is proven.Semiconvergents are defined and corresponding monotony properties are given.
Best approximations of a real number are introduced in Section 2.5.It is proven that best approximations of the second kind are convergents and vice versa (Lagrange's theorem).Best approximations of the first kind are proven to be convergents or semiconvergents (another theorem by Lagrange).Finally, Legendre's theorem is presented, which is the main result about continued fractions required by Shor's algorithm: it allows the implication that a given fraction is a convergent of another number.
Section 3 is devoted to estimating the probability that convergents can be used to compute periods, i.e., that Legendre's theorem can be applied.
At the beginning of Section 3, Section 3.1 proves a lower bound and an upper bound for the secant lengths of the unit circle.This estimation is central for estimating the aforementioned probability.
Section 3.2 contains many different estimations of parameters that appear in the measurement result of Shor's algorithm.In Section 3.2.1,we recall the very basics of modular arithmetic, relate this to group theory, and use Lagrange's theorem from group theory to prove that the period of the modular exponentiation function in Shor's algorithm is less than the number to be factorized (Lemma 8).Intervals of consecutive multiples of the period are studied in Section 3.2.2: it is shown that multiples of N are sparsely scattered across these intervals (Note 12).This implies that measurement results are somehow centered around multiples of N/p (Corollary 9).The cardinality of arguments in the superposition that build the pre-image of a certain f (x) is estimated in Section 3.2.3.Section 3.2.4proves bounds of phases of amplitudes relevant for computing the probability of measurement results as a geometric sum.
Finally, Section 3.3 computes this probability: it is proven that a measurement result is close to a multiple of N/p with probability of approximately 4/π 2 (Lemma 10).Section 3.4 shows that this measurement result fulfills the assumption of Legendre's theorem (Theorem 15).Thus, by computing convergents, the period can be determined (Theorem 16 and Section 3.4.1).Section 3.5 sketches how the main results contribute to the proof of Shor's algorithm.Its purpose is to avoid getting lost in the huge amount of low-level details.
A brief conclusion and discussion of related work ends this contribution with Section 4.

Continued Fractions 2.1. Definition of Continued Fractions and Their Computation
We define the notion of continued fractions and give an example of how to compute them.
Definition 1.An expression of the form with a i , b i ∈ C is called an infinite continued fraction.If, in this expression, it is b i = 1 for all i, a 0 ∈ Z, and a i ∈ N for i≥1, the expression is called a regular continued fraction.
A continued fraction is, thus, the following expression: A continued fraction of a rational number a/b is computed as follows: the integer part a/b becomes a 0 ∈ Z, leaving the non-negative rational remainder x 1 /y 1 ∈ Q.The latter is now written as 1/(y 1 /x 1 ), resulting in Next, the integer part y 1 /x 1 becomes a 1 , leaving a rational remainder that is treated as before.This processing stops until the rational remainder is zero.Figure 1 gives an example of the processing.
Section 3.5 sketches how the main results contribute to the proof of Shor's algorithm.Its purpose is to avoid getting lost in the huge amount of low-level details.
A brief conclusion and discussion of related work ends this contribution with Section 4.

Definition of Continued Fractions and Their Computation
We define the notion of continued fractions and give an example of how to compute them.

Definition 1. An expression of the form
with   ,   ∈ ℂ is called an infinite continued fraction.If, in this expression, it is   = 1 for all i,  0 ∈ ℤ, and   ∈ ℕ for i≥1, the expression is called a regular continued fraction.
A finite regular continued fraction (simply called a continued fraction) satisfies, in addition, the condition ∃ ∈ ℕ∀ ∈ ℕ:  = 0 (convention: "1/0 = 0").A continued fraction is, thus, the following expression: A continued fraction of a rational number a/b is computed as follows: the integer part

⌊𝑎 𝑏
⁄ ⌋ becomes  0 ∈ ℤ, leaving the non-negative rational remainder  / ∈ ℚ.The latter is now written as 1/( / ), resulting in Next, the integer part ⌊  ⁄ ⌋ becomes  1 , leaving a rational remainder that is treated as before.This processing stops until the rational remainder is zero.Figure 1 gives an example of the processing.Beside this straightforward proceeding to compute continued fractions, the wellknown Euclidian algorithm can be used for this purpose too. Figure 2 gives a corresponding example; it should be self-descriptive.
Beside this straightforward proceeding to compute continued fractio known Euclidian algorithm can be used for this purpose too. Figure 2 gives a ing example; it should be self-descriptive.Formally, a continued fraction can always be reduced such that its la greater than or equal to 2.  Formally, a continued fraction can always be reduced such that its last element is greater than or equal to 2. Note 1.Let [a 0 ; a 1 , . . . ,a N ] be a continued fraction.Then: Especially, it can always be achieved that a continued fraction [a 0 ; a 1 , . . . ,a N ] satisfies a N ≥ 2.

Proof. The following simple computation proves the first claim:
[a 0 ; a 1 , . . . ,a N ] = a 0 + Equation ( 5) implies a straightforward way to compute the value represented by a continued fraction [a 0 ; a 1 , . . . ,a N ]: see Figure 3.
AppliedMath 2022, 2, FOR PEER REVIEW 4 Beside this straightforward proceeding to compute continued fractions, the wellknown Euclidian algorithm can be used for this purpose too. Figure 2 gives a corresponding example; it should be self-descriptive.Formally, a continued fraction can always be reduced such that its last element is greater than or equal to 2.

Convergents
Next, we define the "workhorses" of the theory of continued fractions.
Convergents can be computed recursively based on the following theorem:

Theorem 1. (Recursion Theorem)
Define: and define: Then, for every convergent [a 0 ; a 1 , . . . ,a n ], it is: [a 0 ; a 1 , . . . ,a n ] = p n q n (6) Induction hypothesis: [a 0 ; a 1 , . . . , and the last continued fraction has n elements, i.e., the induction hypothesis applies: Here, (A) is valid because of the induction hypothesis, and (B) is the definition of p n+1 and q n+1 .The recursion theorem implies the often used.

Corollary 1.
Numerators and denominators of convergents of a continued fraction [a 0 ; a 1 , . . . ,a N ] with a 0 ≥ 0 are strictly monotonically increasing: p n > p n−1 and q n > q n−1 for all n ∈ N.
The next theorem is about the sign of a combination of the numerators and denominators of consecutive convergents of a continued fraction.
In case the numerators and denominators stem from the n-th convergent and the (n − 2)-nd convergent, the last n-th element of the convergent becomes part of the equation.

Theorem 3. (Second Sign Theorem)
For [a 0 ; a 1 , . . . ,a n ] = p n q n , the following holds: Proof.It is p n = a n p n−1 + p n−2 and q n = a n q n−1 + q n−2 .
Multiplying the first equation by q n−2 and the second equation by p n−2 results in q n−2 p n = q n−2 a n p n−1 + q n−2 p n−2 and p n−2 q n = p n−2 a n q n−1 + p n−2 q n−2 .Next, both equations are subtracted: where (A) is implied by the sign theorem (Theorem 2) and considering (−1) n−2 = (−1) n .
The sign theorem immediately yields the important.

Corollary 2.
Numerator and denominator of a convergent are co-prime.
Proof.Let t be a divisor of p n and q n , i.e., t|p n and t|q n .Then, t|(p n q n−1 − p n−1 q n ) , but (p n q n−1 − p n−1 q n ) = (−1) n−1 according to the sign theorem.Thus, t = ±1.
Convergents can be represented as a sum of fractions with alternating sign and whose denominators consist of products of two consecutive denominators from the recursion theorem.

Theorem 4. (Representation as a Sum)
Each convergent can be represented as a sum: [a 0 ; a 1 , . . . ,a n ] = a 0 + 1 Proof.Let [a 0 ; a 1 , . . . ,a n ] = p n q n .Since − p i q i + p i q i = 0, we can write Computing the differences results in [a 0 ; a 1 , . . . ,a n ] = p n q n−1 −q n p n−1 q n q n−1 where the sign theorem is applied in (A) and the last term a 0 = p 0 /q 0 is the recursion theorem.
The next theorem is key for many estimations in the domain of continued fractions.

Theorem 5. (Monotony Theorem)
Let x n de f = p n q n = [a 0 ; a 1 , . . . ,a n ] denote the n-th convergent.Then: I.e., even convergents are strictly monotonically increasing, and odd convergents are strictly monotonically decreasing.
Proof.We compute the following difference, where (A) again uses − p i q i + p i q i = 0: q n−2 = p n q n−1 −q n p n−1 q n q n−1 q n q n−1 q n−2 q n q n−1 q n−2 (C) = (−1) n a n q n−1 q n q n−1 q n−2 = (−1) n a n q n q n−2 (B) is because of the sign theorem, and (C) follows from q n = a n q n−1 + q n−2 , i.e., the recursion theorem.Now, because of a n , q n , q n−2 > 0, it is a n q n q n−2 > 0. Thus, (−1) n a n q n q n−2 > 0 for n even and (−1) n a n q n q n−2 < 0 for n odd.This implies x n = (−1) n a n q n q n−2 + x n−2 > x n−2 for n even as well as x n = (−1) n a n q n q n−2 + x n−2 < x n−2 for n odd.
While even convergents are increasing and odd convergence are decreasing, all even convergents are smaller than all odd convergents.This is the content of the next very important theorem.
For n > m, the monotony theorem yields x 2m+1 > x 2n+1 and with x 2n+1 > x 2n we see The following often-used corollary computes the difference of two immediately succeeding convergents by mean of the denominators of the convergents, while the difference of the n-th convergent and the (n − 2)-nd convergent adds the n-th element of the n-th convergent as a factor.

Corollary 3.
p n q n − p n−1 q n−1 = (−1) n−1 q n q n−1 (10) and p n q n − p n−2 q n−2 = (−1) n a n q n q n−2 (11) Proof.Equation (10) is the first equation from the proof of Theorem 6.The second equation follows because of where (A) is because of the second sign theorem (Theorem 3).
We already saw that the even convergents are strictly monotonically increasing, that the odd convergents are strictly monotonically decreasing, and that each even convergent is less than all odd convergents.According to the next theorem, the value of a continued fraction lies between the even convergents and the odd convergents, i.e., this value is larger than all even convergents and smaller than all odd convergents.The situation is depicted in Figure 4.
AppliedMath 2022, 2, FOR PEER REVIEW larger than all even convergents and smaller than all odd convergents.The sit depicted in Figure 4.Note that the notion of the value of a continued fraction is defined for finite co fractions.In Section 4, this notion will also be defined for regular infinite continu tions.Note that the notion of the value of a continued fraction is defined for finite continued fractions.In Section 4, this notion will also be defined for regular infinite continued fractions.

Theorem 7. (Nesting Theorem)
Let x be the value of the continued fraction [a 0 ; a 1 , . . . ,a N ] and let x k be its convergents.Then: ∀m, n < N : Proof.The value of x is the convergent with the highest index N, i.e., x = x N = [a 0 ; a 1 , . . . ,a N ].
Let N = 2k be even.Since even convergents are strictly monotonically increasing, we know that ∀2m < N : x 2m < x 2k = x N = x, and according to the convergent comparison theorem (Theorem 6), we know ∀2n Let N = 2k + 1 be odd.Since odd convergents are strictly monotonically decreasing, we know that ∀2n + 1 < N : x 2n+1 > x 2k+1 = x N = x, and according to the convergent comparison theorem (Theorem 6), we know ∀2m Because the value of a continued fraction is nested within its even convergents and odd convergents, the distance of this value from any of its convergents can be estimated by the distance of two consecutive convergents: Theorem 8. (Distance Theorem) Let x = [a 0 ; a 1 , . . . ,a N ] and let x k be its convergents.Then: and Proof.Let n be even.Then, Together, this proves Equation (13).Equation ( 14) is proven similarly.
Figure 5 shows the corresponding geometric situation for an even n.Note that the notion of the value of a continued fraction is defined for finite continued fractions.In Section 4, this notion will also be defined for regular infinite continued fractions.
Let N = 2k be even.Since even convergents are strictly monotonically increasing, we know that ∀2 < :  <  =  = , and according to the convergent comparison theorem (Theorem 6), we know ∀2 + 1:  =  =  <  .Let N = 2k + 1 be odd.Since odd convergents are strictly monotonically decreasing, we know that ∀2 + 1 < :  >  =  =  , and according to the convergent comparison theorem (Theorem 6), we know ∀2:  =  =  >  .□ Because the value of a continued fraction is nested within its even convergents and odd convergents, the distance of this value from any of its convergents can be estimated by the distance of two consecutive convergents:

Theorem 8. (Distance Theorem)
Let  = [ ;  , . . .,  ] and let   be its convergents.Then: Together, this proves Equation (13).Equation ( 14) is proven similarly.□ Figure 5 shows the corresponding geometric situation for an even n.Similarly, the difference between any two arbitrary convergents can be estimated by the difference of the convergent with the smaller index and its immediate predecessor: Theorem 9. (Difference Theorem) Let x = [a 0 ; a 1 , . . . ,a N ] and let x k be its convergents.Then: Proof.Let n be even, e.g., n = 2k.Let m = 2t be even.By Theorem 6, even convergents are smaller than all odd convergents, i.e., x 2t < x 2k−1 for any t ∈ N. Thus, Let m = 2t − 1 be odd.By the monotony theorem (Theorem 5), odd convergents are strictly monotonically decreasing, i.e., x 2t−1 < x 2k−1 for each t > k.Thus, For n odd, the proof is analogous.
The geometry of the last theorem is depicted in Figure 6.
For n odd, the proof is analogous.□ The geometry of the last theorem is depicted in Figure 6.
The proof for n ≥ 3 is by induction.It is The distance between any two convergents is smaller than the distance between the convergent with the smaller index and its immediate predecessor.
In several calculations, the size of the denominator of a convergent must be estimated: Lemma 1. (Size of Denominators) For the denominator q n of a convergent p n q n = [a 0 ; a 1 , . . . ,a n ], the following holds: and ∀n > 3 : Proof.By definition, q 0 = 1 > 0, and q 1 = a 1 ≥ 1 because a i ∈ N, and finally, (A) holds because of the recursion theorem (Theorem 1), (B) is by definition of q 0 , (C) is because a 2 ∈ N, and (D) has been seen just before (i.e., q 1 ≥ 1).This proves the lemma for n ≤ 2.
The proof for n ≥ 3 is by induction.It is and (E) is by induction hypothesis applied to q n−1 .This proves Equation (16).Equation ( 17) is proven by induction again.Let n > 3. The argumentation is exactly as before, with the exception of (D): In fact, denominators of a convergent grow much faster than the inequation q n > n may indicate:

Convergence of Infinite Regular Continuous Fractions
In Section 2.1, we presented an algorithm to compute the continued fraction representation of a rational number.Next, we show how to compute such a representation for a non-rational number (Algorithm 1).

2.
Then, [b 0 ; b 1 , b 2 , . . . is the continued fraction representation of α.Each α i is called the i-th complete quotient of α.
The above algorithm does not terminate, i.e., the continued fraction representation of a non-rational number is infinite.This is the content of the following note: In Algorithm 1, it is α i / ∈ Z.

Bounds Expressed by Denominators of Convergents
In the following, we give upper bounds and lower bounds of the appr a number by the convergents of its continued fraction representation by me nominators of the convergents.
First, we start with estimations of upper bounds:

Lemma 3. (Upper Bounds)
Let   ⁄ be a convergent of the continued fraction representation of where (A) holds because of  >  (Corollary 1), and (B) is true becau (Lemma 1).□ An immediate consequence of this theorem is the convergence of the se convergents of a continued fraction to the value of the continued fraction way, is the origin of the name "convergents".

Corollary 4.
The series ( / ) of the convergents of the continued fraction repr  ∈ ℝ ∖ ℚ converges to x:

Bounds Expressed by Denominators of Convergents
In the following, we give upper bounds and lower bounds of the approximations of a number by the convergents of its continued fraction representation by means of the denominators of the convergents.
First, we start with estimations of upper bounds: Lemma 3. (Upper Bounds) Let p n /q n be a convergent of the continued fraction representation of x.Then: According to Corollary 3 (Equation (10)), it is where (A) holds because of q n+1 > q n (Corollary 1), and (B) is true because of q n ≥ n (Lemma 1).
An immediate consequence of this theorem is the convergence of the sequence of the convergents of a continued fraction to the value of the continued fraction.This, by the way, is the origin of the name "convergents".Corollary 4. The series (p n /q n ) of the convergents of the continued fraction representation of x ∈ R \ Q converges to x: lim p n q n = x Proof.The claim follows immediately from x − p n q n < 1 n 2 .
Often, two fractions are compared by means of their mediant ("mediant" means "somewhere in between").Definition 3.For a/b, c/d ∈ Q and b, d > 0, the term a+c b+d is called the mediant of the two fractions.
The following simple inequation is often used.

Note 3. (Mediant Property)
Let a/b, c/d ∈ Q and b, d > 0 and a b < c d .Then: = bc−ad b(b+d) > 0 and thus a b < a+c b+d .The inequation a+c b+d < c d follows similarly.
Mediants of convergents that are weighted in a certain way are another important concept for computing bounds: Definition 4. The term x n,t = tp n+1 +p n tq n+1 +q n with 1 ≤ t ≤ a n+2 is called the (n,t)-th semiconvergent.
Semiconvergents of an even n are strictly monotonically increasing, and semiconvergents of an odd n are strictly monotonically decreasing.This is the content of the following lemma.
Let n be odd.Then, x n,t > x n,t+1 .
Proof.A simple calculation and the use of the sign theorem (Theorem 2) results in The denominator of the last fraction is always positive.Thus, the last term is positive iff n is even (i.e., x n,t+1 − x n,t > 0), and it is negative iff n is odd (i.e., x n,t+1 − x n,t < 0).
In order to simplify proofs in what follows, the following conventions are used: where (A) is the recursion theorem and (B) follows because a 1 ≥ 1; thus, Based on this, we can refine Figure 4, which depicts the nesting and ordering of convergents by including semiconvergents: Between two succeeding convergents (e.g., x n and x n+2 in Figure 8, the corresponding semiconvergents ordered according to Lemma 4 are nested (in increasing order as shown for an even n in Figure 8).Furthermore, beyond , the semiconvergents x −1,t are added.
Based on this, we can refine Figure 4, which depicts the nesting and ordering of con vergents by including semiconvergents: Between two succeeding convergents (e.g.,  and  in Figure 8, the corresponding semiconvergents ordered according to Lemma 4 are nested (in increasing order as shown for an even n in Figure 8).Furthermore, beyond  =  + , the semiconvergents  −1, are added.

Lemma 5. (Lower Bounds)
Let   ⁄ be a convergent of the continued fraction representation of x.Then: Proof.The proof is based on the following claims: Proof.
is the mediant of and .Thus, the mediant property (Note Now, we are prepared to prove a lower bound of the approximation of a number by the convergents of its continued fraction representation by means of the denominators of the convergents.

Lemma 5. (Lower Bounds)
Let p n /q n be a convergent of the continued fraction representation of x.Then: Proof.The proof is based on the following claims: Claim 1. n even ⇒ p n q n < p n+1 +p n q n+1 +q n < x < p n+1 q n+1 . Proof.
p n+1 +p n q n+1 +q n is the mediant of p n+1 q n+1 and p n q n .Thus, the mediant property (Note 3) shows that p n q n < p n+1 +p n q n+1 +q n < p n+1 q n+1 . Then: where (A) follows by the monotony of even semiconvergents (Lemma 4), and (B) is the recursion theorem.Because of Theorem 7 (note that n + 2 is even and n + 1 is odd), it is . This proves Claim 1.
Proof.As before, p n+1 +p n q n+1 +q n is the mediant of p n+1 q n+1 and p n q n .Because n is odd, it is (Theorem 7).Thus, p n+1 q n+1 < p n+1 +p n q n+1 +q n < p n q n because of the mediant property (Note 3).Then: where (A) follows by the monotony of odd semiconvergents (Lemma 4), and (B) is the recursion theorem.Because of Theorem 7 (note that n − 1 is even and n + 2 is odd), it is , and because n is odd, it is p n+2 q n+2 < p n q n .This proves Claim 2. (claim2) With Claim 1, for even n, it is p n q n < p n+1 +p n q n+1 +q n < x ⇒ x − p n q n > p n +p n+1 q n +q n+1 − p n q n .With Claim 2, for n odd, it is x < p n+1 +p n q n+1 +q n < p n q n ⇒ p n q n − x > p n q n − p n +p n+1 q n +q n+1 ⇔ − x − p n q n > − p n +p n+1 q n +q n+1 − p n q n .Thus, for any k ∈ N: . Next, we compute where (A) is the sign theorem (Theorem 2).
Because of q k+1 > q k (Corollary 1), it is Using the last inequality in Lemma 5 (Lower Bounds) and using Lemma 3 (Upper Bounds), we obtain the concluding theorem of this section: In summary, we have proved the following: Theorem 10. (Bounds of Approximations by Convergents) Let p k /q k be a convergent of the continued fraction representation of x.Then:

Best Approximations
Our goal is to approximate a real number by a rational number as good as possible while keeping the denominator of the rational number "small".Keeping the denominator small is important because in practice, every real number can only be given up to a certain degree of precision, and this is achieved by means of a huge denominator and corresponding numerator.i.e., approximating a real number by a rational number with a huge denominator is canonical, but finding a small denominator is a problem.This is captured by the following: Often, the addition "of the first kind" is omitted.By definition, a best approximation of a real number can only be improved if the denominator of the given approximation is increased.
If p/q is a best approximation of α, then α − p q = 1 q |qα − p| is small and, thus, |qα − p| is small.Measuring the goodness of an approximation this way results in the following: The question is whether every best approximation is also a best approximation of the second kind.Now, 1/3 is a best approximation of 1/5 because the only possible fractions for c/d, with d ≤ 3 = q, are 0, 1/2, 2/3, and 1, and these numbers satisfy 1  5 Thus, with d = 1 and q = 3 (i.e., d < q) and α = 1/5, we found a fraction c/d = 0/1 with |dα − c| < |qα − p|!As a consequence, although 1/3 is a best approximation of the first kind of 1/5, it is not a best approximation of the second kind.
Thus, not all best approximations of the first kind are best approximations of the second kind.But the reverse holds true: Lemma 6. (Every 2nd Kind Best Approximation is a 1st Kind Best Approximation) If p/q ∈ Q is a best approximation of the second kind of α ∈ R, then p/q is also a best approximation of the first kind of α.
Proof (by contradiction).Assume p/q is not a best approximation of the first kind.Then, α − c d ≤ α − p q for a fraction c/d with d < q.Multiplying both inequations results in which is a contradiction because p/q is a best approximation of the second kind.
The next simple estimation about the distance of two fractions by means of the product of their denominators is often used.

Note 4. (Distance of Fractions)
Let a b , p q ∈ Q with a b = p q .Then: Proof.With a, p ∈ Z and b, q ∈ N, it is pb − aq ∈ Z. Also, pb − aq = 0 because otherwise pb = aq ⇔ p q = a b which contradicts the premise.Thus, |pb − aq| ∈ N, i.e., |pb − aq| ≥ 1.This implies where |qb| = qb because b, q ∈ N.
Next, we prove that every best approximation of the second kind is a convergent.

Proof (by contradiction). Assume
= q 0 q 0 = x 0 , (B) is because of the recursion theorem. (claim1) Thus, the geometric situation is as depicted in Figure 9, i.e., a/b is in the grey shaded area being greater than or equal to the convergent x 0 .This will be refined in what follows.Next, we proceed with a proof by contradiction assuming that   ⁄ is not a conver gent of x.
According to Claim 1, ≥  =  .Thus, one of the following must hold: This situation is shown in Figure 10.Together, , where (E) is again using Note 4 This implies   − ≥ ⇒ | − | ≥ (iv).
Lemma 3 (Upper Bounds) tells us that  − < which is equivalent to Since   <  (see (iii) above), this is a contradiction to   ⁄ being a best approximation of the second kind of x.Thus, Case (1) does not occur.Next, we proceed with a proof by contradiction assuming that a/b is not a convergent of x.
Assumption. a b = q k q k = x k for k ∈ N. According to Claim 1, a b ≥ a 0 = x 0 .Thus, one of the following must hold: This situation is shown in Figure 10.
Thus, the geometric situation is as depicted in Figure 9, i.e.,   is in the grey area being greater than or equal to the convergent  .This will be refined in what Next, we proceed with a proof by contradiction assuming that   ⁄ is not a gent of x.
According to Claim 1, ≥  =  .Thus, one of the following must hold: This situation is shown in Figure 10.Together, , where (E) is again using Lemma 3 (Upper Bounds) tells us that  − < which is equiv Since   <  (see (iii) above), this is a contradiction to   ⁄ being a best approx of the second kind of x.Thus, Case (1) does not occur.Case (1).
Lemma 3 (Upper Bounds) tells us that x − p k q k < 1 q k q k+1 which is equivalent to iv) just before).Since q k < b (see (iii) above), this is a contradiction to a/b being a best approximation of the second kind of x.Thus, Case (1) does not occur.Consequently, the assumption is wrong and there is a k ∈ N with a b = q k q k = x k , i.e., a/b is a convergent.So, every best approximation of the second kind is a convergent.The next theorem proves the reverse, i.e., that every convergent is a best approximation of the second kind.

Case (2). This case is shown in
Theorem 12. (Lagrange, 1798-Convergents are 2nd Kind Best Approximations) Let p n /q n be a convergent of x = [a 0 ; a 1 , • • • , a N ], x = a 0 + 1 2 , and n = 0.Then, for d ≤ q n and c d = p n q n it is |dx − c| > |q n x − p n |, i.e., the convergent is a best approximation of the second kind of x.
The cases x = a 0 + 1 2 and n = 0 are excluded because the convergent p 0 q 0 = a 0 1 is not a best approximation of the second kind of q 0 would be a best approximation of the second kind of x, then The proof of Lagrange's theorem is very technical.First, the expression |y 0 x − z 0 | is analyzed to find the smallest integral numbers y 0 and z 0 such that the expression is minimized under the constraint y 0 ∈ {q 0 , . . . ,q k }, i.e., y 0 is a denominator of a convergent.It is shown both that z 0 /y 0 is a best approximation of the second kind of x, and that z 0 = p k and y 0 = q k .Proof.Let k ∈ Z and let p k /q k be a convergent.First, we are looking for the smallest numbers y 0 , z 0 ∈ Z with y 0 ∈ {q 0 , . . . ,q k } such that |y 0 x − z 0 | is minimal.
It is min x , but in general y / ∈ Z.Looking for a solution y 0 ∈ {q 0 , . . . ,q k } ⊆ Z that minimizes |y 0 x − z| results in the following potential positions of z/x with respect to the denominators q 0 , . . ., q k (see Figure 12): • Case 1: z/x > q k .Then, y 0 = q k is the solution; Then, y 0 = q 0 is the solution; Let q i ≤ z/x ≤ q i+1 for 1 ≤ i ≤ k.

•
Case 3: For |q i+1 x − z| < |q i x − z| (i.e., z/x is closer to q i+1 than to q i ), y 0 = q i+1 is the solution, and for |q i+1 x − z| > |q i x − z| (i.e., z/x is closer to q i than to q i+1 ), y 0 = q i is the solution; • Case 4: For |q i+1 x − z| = |q i x − z| (i.e., z/x is exactly in the middle between q i and q i+1 ), y 0 = q i is the solution because q i < q i+1 , and we are looking for the smallest y 0 , especially y 0 ≥ q 0 = 1.  the following cases can be distinguished (see Figure 13): • Case 0: It may happen that y 0 x ∈ Z.Then, choose z 0 = y 0 x; • Case 1: y 0 x is between two integral numbers s and t, i.e., s < y 0 x < t.For |y 0 x − s| > |y 0 x − t| (i.e., y 0 x is closer to t than to s), z 0 = t is the solution; and for |y 0 x − s| < |y 0 x − t| (i.e., y 0 x is closer to s than to t), z 0 = s is the solution; • Case 2: For |y 0 x − s| = |y 0 x − t| (i.e., y 0 x is exactly in the middle between t and s), z 0 = s is the solution because s < t, and we are looking for the smallest z 0 .Claim 1. z 0 is uniquely determined.

Proof (by contradiction).
Assume there exists a z 0 ∈ Z with z 0 = z 0 and x − z 0 y 0 = x − z 0 y 0 .This can only happen iff one term is positive and the other is negative, i.e., for example, if x − z 0 y 0 > 0 and x − z 0 y 0 < 0, and then x − z 0 y 0 = z 0 y 0 − x, i.e., x = z 0 + z 0 2y 0 .

Proof (by contradiction).
Let z 0 + z 0 = Lp and 2y 0 = Lq with L > 1.Then, Then, with 2y 0 = Lq and L/2 > 1, it follows: (ii) it must be q = y 0 .This is a contradiction because q < y 0 according to (ii) before.Thus, 1 < L ≤ 2, i.e., L = 2.With L = 2 and 2y 0 = Lq, we get y 0 = q, which implies.By definition of z 0 , |qx − p| = |y 0 x − p| > |y 0 x − z 0 |.However, |qx − p| = 0 (see (i) above); thus, 0 > |y 0 x − z 0 |, which is a contraction.(claim2) We continue the proof of Claim 1: It is z 0 + z 0 2y 0 = x and also x = p N q N , i.e., z 0 + z 0 2y 0 = p N q N .Because gcd(z 0 + z 0 , 2y 0 ) = 1 according to Claim 2, it follows that p N = z 0 + z 0 and q N = 2y 0 .Now, let N ≥ 2.Then, it is 2y 0 = q N (A) = a N q N−1 + q N−2 ((A) uses the recursion theorem (Theorem 1)), and with Note 1, it is a N ≥ 2. Thus, 2y 0 where (C) holds because of the sign theorem and (D) because y 0 ≥ 1 (see the end of the proof of Step 1).Furthermore, where (E) is true because z 0 = z 0 and, thus, | z 0 − z 0 | ≥ 1 for integral numbers z 0 and z 0 .Together, we obtained |y , which is a contradiction to the choice of y 0 and z 0 !This proves Claim 1 for N ≥ 2. Now, let N = 1 and choose a 1 = 2 (based on Note 1, the highest element of a continued fraction is always greater than or equal 2, thus a 1 ≥ 2).Then ((F) is the recursion theorem) which has been excluded from the theorem.Thus, let N = 1 and a 1 > 2. Then where (G) applies the recursion theorem and (H) the sign theorem.Because of (iii), it is Next, we observe Claim 3. z 0 y 0 is a best approximation of the second kind of x.Otherwise: |bx − a| ≤ |y 0 x − z 0 | for an a b = z 0 y 0 with b ≤ y 0 , which contradicts the definition of y 0 and z 0 !(claim3) According to Theorem 11, z 0 y 0 is a convergent of x, i.e., z 0 y 0 = p s q s for an s ≤ k.If s = k, the proof is done.Thus, we assume s < k.
Next, we get |q s x − p s | = q s x − p s q s (I) > q s 1 (q s + q s+1 )q s = 1 q s + q s+1 (J) where (I) is Lemma 5 (Lower Bounds) and (J) is Claim 4.
With z 0 y 0 = p s q s and the definition of y 0 (= q s ) and z 0 (= p s ) (i.e., the minimizing property), it is , which implies q k+1 < q k + q k−1 .This is a contradiction; because of the recursion theorem, it is q k+1 = a k+1 q k + q k−1 (L) ≥ q k + q k−1 , where (L) holds with a k ≥ 1.Thus, s = k which proves the overall theorem.
Putting the last two theorems together yields: Corollary 5. a/b is a best approximation of the second kind of x ⇔ x is a convergent of x.
According to Theorem 12, every convergent is a best approximation of the second kind, and each best approximation of the second kind is also a best approximation of the first kind (Lemma 6).We keep this observation as: Note 5. Every convergent is a best approximation of the first kind.
But are best approximations of the first kind also always convergents?Not quite: the next theorem proves that a best approximation of the first kind is a convergent or a semiconvergent.

Theorem 13. (Lagrange, 1798-1st Kind Best Approximations are Convergents or Semiconvergents)
Let a/b be a best approximation of the first kind of x = [a 0 ; Otherwise: a b ≥ a 0 + 1 and based on the geometric situation depicted in Figure 8, it follows that x − a 0 +1 1 ≤ x − a b with 1 ≤ b, which contradicts a/b being a best approximation of the first kind.(claim2) Consequently, a/b lies between x 0 = a 0 and x −1,1 = a 0 + 1 (see Equation ( 22)), i.e., and is, thus, covered by the set of intervals defined by the convergents and semiconvergents of x (see Figure 8).
Assumption. a/b is neither a convergent nor a semiconvergent.This results in the following cases: • Case 1: a/b lies between two semiconvergents x k−1,r and x k−1,r+1 ; • Case 2: a/b lies between two convergents x k and x k+2 ; • Case 3: a/b lies between a convergent and a semiconvergent.
We will show that all three cases lead to a contradiction, i.e., the assumption must be false; thus, the theorem is proven.
where (A) results from the same computation performed in the proof of Lemma 4. Furthermore, it is where (B) is seen to be valid as follows: a(rq k would be zero, the first modulus in (i) would be zero, i.e., a/b = x k−1,r which contradicts the assumption of the claim, which in turn implies |a(rq Together, Because of the monotony of the sequence of semiconvergents (x s,t ) t (Lemma 4), it is for an odd k (i.e., k − 1 even) x k−1,r < x k−1,r+1 (see the geometric situation in Figure 14); Case 3.   ⁄ lies between a convergent and a semiconvergent.
This implies that   ⁄ lies between   and  , (see Figure 8), otherw would lie between two semiconvergents, which has already been covered in Case Thus, − <  −  , , but thus, But with (ii), it is (r + 1)q k + q k−1 < b; thus, a/b is not a best approximation of the first kind to x, which is a contradiction.k even leads to a contradiction too, i.e., Case (1) is not possible (case1) Case 2. a/b lies between x k and x k+2 .
where (C) is Equation (11) from Corollary 3, and with Note 4, it is a Because of the geometric situation shown in Figure 15 , which is a contradiction to a/b being a best approximation of the first kind to x and b > q k+2 .(case2) Because of the monotony of the sequence of semiconvergents ( , ) (Lemm for an odd  (i.e.,  − 1 even)  , <  , (see the geometric situation i 14); Case 3. a/b lies between a convergent and a semiconvergent.This implies that a/b lies between x k and x k,1 (see Figure 8), otherwise a/b would lie between two semiconvergents, which has already been covered in Case 1.
where (D) is the sign theorem.I.e., it is a b − p k q k < 1 q k (q k+1 +q k ) .As before, with Note 4, it is The geometric situation from Figure 16 , which is a contradiction to a/b being a best approximation of the first kind to x and b > q k+1 + q k .

Estimating Secant Lengths
In this part, we use the main arguments of [2].
In order to estimate the probability of the occurrence of a certain performed the quantum Fourier transform, we need the following est bound and an upper bound of the length of a secant of the unit circle: Finally, we give a simple criterion that allows us to prove that a given fraction is a convergent of another real number.This theorem is a cornerstone of computing a prime factor with Shor's algorithm.
With Note 4 (Distance of Fractions), it is also c d − a b ≥ 1 db .Together, it is

Estimating Secant Lengths
In this part, we use the main arguments of [2].
In order to estimate the probability of the occurrence of a certain state after having performed the quantum Fourier transform, we need the following estimation of a lower bound and an upper bound of the length of a secant of the unit circle: Proof.The upper bound follows from elementary geometry, namely that the length of a secant is less than or equal to the length of the corresponding arc of a circle (see Figure 17).The length of the arc determined by the angle ϕ on a circle of radius r is rϕ, i.e., if the circle is a unit circle, the length of the arc (green in the   A secant of the unit circle (red in the Figure 17) can be defined by the two complex numbers on the unit circle (black in the Figure 17) that are the endpoints of the secant.Thus, the length of this secant is the difference of these complex numbers.One of these points can always be 1 because a corresponding rotation is length-preserving; the other point is then e iϕ , where ϕ is the angle of the arc cut by the secant.The length of this secant is then 1 − e iϕ .This proves the inequality 1 − e iϕ ≤ |ϕ|.(upperbound) Next, we compute π .From elementary calculus, it is known that a function ψ is concave on D ⊆ R if and only if its second derivative is not positive on D, i.e., ψ ≤ 0 on D. (Reminder: i.e., for any two points on the graph of ψ, the secant between these points is below the graph, Figure 18).

Basics from Number Theory
For convenience, we state the definition of the modulo function.Definition 7. The modulo function is the following map: z mod n is, thus, the residue left when dividing z by n.I.e., if r = z mod n, then there is a number k ∈ N 0 such that z = kn + r with 0 ≤ r < n.
If z mod n = z mod n = r, we find numbers k 1 and k 2 such that z = k 1 n + r and z = k 2 n + r with 0 ≤ r < n.This implies that z − z = (k 1 − k 2 )n =: kn, i.e., n is a divisor of z − z (in symbols: n|(z − z) ).We also obtain that z mod n = z mod n implies that z = z + kn.
The equation z mod n = z mod n is abbreviated as z ≡ z (mod n); in words, z is congruent z modulo n.As shown just before, z ≡ z (modn ) is equivalent to n|(z − z) and to z = z + kn.We keep this as Note 6. z Furthermore, we state the definition of modular exponentiation which turns out to play a key role in finding factors.

Definition 8.
For 0 < a < n, the modular exponentiation function is the following map: The smallest number p that satisfies f (x) = f (x + p) for all x is called the period of f.Especially, with x = 0, we get f (0) = f (p) which means that a p mod n = a 0 modn = 1 mod n, i.e., a p ≡ 1 (mod n) which in turn is equivalent to n|(a p − 1) .
Thus, we have proven:
Finding a factor of n can be achieved by finding the period p of the function f (x) = a x modn.This is seen as follows: Let p be the period of f , then n|(a p − 1) , i.e., (a p − 1) = kn.Assume p is even (if p is odd, Shor's algorithm is repeated with a different a, until an even p is found).With such an even p, it is (a p − 1) = a p/2 − 1 a p/2 + 1 = kn which implies that a p/2 − 1 and a p/2 + 1 have a common divisor, which in turn means that gcd a p/2 − 1, n or gcd a p/2 + 1, n is a divisor of n.Thus, if an even period has been determined, classically efficient calculations can be used to compute a factor of n.If this factor is a prime number, we can finish.Otherwise, we continue determining a factor of the former factor, and so on, until we end up with a prime factor of n.
Next, we determine an upper bound of the period p of the modular exponentiation by using group theory.A simple calculation shows that "≡" is an equivalence relation on Z.The equivalence class of z ∈ Z is denoted as [z] and is referred to as the residue class of z modulo n.It is Note 6), where the latter set is sometimes written as z + nZ.The set of all residue classes modulo n is denoted as Z n , i.e., Z n We can multiply two residue classes modulo n as follows: Since every integer is a divisor of itself, it is gcd(n, n) = n = 1 (for n ≥ 2), i.e., the cardinality of numbers co-prime to n is less than n: n ≥ 2 ⇒ ϕ(n) < n .The well-known Lagrange's theorem from group theory states that for a group G with card G = m < ∞ and for each x ∈ G, it is x m = e (e is the unit element of G)-see Lemma 3.2.5 in [3], for example.Thus, for x ∈ Z * n , it is x ϕ(n) = 1, i.e., x ϕ(n) ≡ 1 (mod n).Since the period p is the smallest number with x p ≡ 1 (mod n), it follows that p ≤ ϕ(n) and, thus, p < n.Now, the assumption of Shor's algorithm is that 0 < a < n and that gcd(a, n) = 1, which ensures that [a] ∈ Z * n ; thus, [a] p ≡ 1 (mod n) and p < n.

Lemma 8.
Let p be the period of f (x) = a x mod n.Then, p < n.

Intervals of Consecutive Multiples of the Period
The relation between N and p is depicted in Figure 19; multiples of N are always contained in closed intervals defined by consecutive multiples of p, i.e., it may happen that a multiple of N coincides with a multiple of p.

Intervals of Consecutive Multiples of the Period
The relation between N and p is depicted in Figure 19; multiples of N are always contained in closed intervals defined by consecutive multiples of p, i.e., it may happen that a multiple of N coincides with a multiple of p.We denote a  with ( − 1) ≤  ≤  by   .This is justified by the next Note 9 which proves that such a  is uniquely determined by .Especially, a multiple  is contained in "its" interval: Proof.Pick an arbitrary k ∈ N, i.e., kN ∈ N is also given.Then, we find a t ∈ N such that tp ≥ kN (trivial because p > 0).Let t be the smallest of such t, i.e., t de f = min t tp ≥ kN .Thus, (t − 1)p ≤ kN because otherwise (t − 1)p > kN, which is a contradiction because t was chosen minimal.
Together, (t − 1)p ≤ kN ≤ tp.The claim follows because k an arbitrary number.
The situation we just discussed is shown in Figure 20.

Intervals of Consecutive Multiples of the Period
The relation between N and p is depicted in Figure 19; multiples of N are contained in closed intervals defined by consecutive multiples of p, i.e., it may that a multiple of N coincides with a multiple of p.We denote a  with ( − 1) ≤  ≤  by   .This is justified by the nex which proves that such a  is uniquely determined by .Especially, a multip contained in "its" interval: Since the period p is the smallest number with  ≡ 1 ( ), it follows that  and, thus,  < .Now, the assumption of Shor's algorithm is that 0 <  <  and that ( which ensures that [] ∈ ℤ * ; thus, [] ≡ 1 ( ) and  < .

Intervals of Consecutive Multiples of the Period
The relation between N and p is depicted in Figure 19; multiples of N are contained in closed intervals defined by consecutive multiples of p, i.e., it may that a multiple of N coincides with a multiple of p.If kN ∈ [(t k − 1)p, t k p], it is t k p − kN ≤ p/2 or kN − (t k − 1)p ≤ p/2 (see Figure 22 or Figure 24).In case kN − (t k − 1)p ≤ p/2, we define t := t k − 1 and kN − tp ≤ p/2 results, and in case of t k p − kN ≤ p/2, we define t := t k implying tp − kN ≤ p/2.According to Note 9, this t is uniquely defined.This proves This result is now used in Equation (37) (step (C) below) and we obtain 1−q A 1−q = 1−q A−1 Using Equation (42) in Equation (35) (step (D) below) results in Furthermore, since N is a "huge" number, we know that the following is "small": p − ε.Since we are not interested in a particular y k , but in any of them, we need to sum up all probabilities P(y k ) to obtain the overall probability P: This proves the claim.
We still need to estimate the probability for the case q = 1.
(Lemma 5) makes use of semiconvergents (Definition 4) and their monotony property (Lemma 4) as well as the nesting theorem (Theorem 7).Remark: Theorem 13, which proves that best approximations of the first kind are convergents or semiconvergents, is not immediately relevant to Shor's algorithm and may be ignored when focusing on Shor's algorithm.

Conclusions and Related Work
The literature analyzing, discussing, and refining Shor's algorithm [1] is vast.Of course, most text books on quantaum computing explain the algorithm too (e.g., [4,5]).In doing so, all this literature puts a sharp focus on the quantum part of the algorithm and sketches its classical parts at various depths.However, the mathematical treatment of the classical aspects is sketchy, omitting most of the details and leaving them as an exercise for the reader with references to corresponding text books from mathematics such as [6] or [7].The lecture notes by Preskill [2] go a bit deeper, especially on the estimation of probabilities, but still omit the low-level details; however, the authors of the contribution at hand benefited a lot by the treatment in [2].It is noted that the genesis for the authors'

Applying Probability Estimations
According to Equation (29) (which is implied by the Born rule), the probability P(y) to measure a particular y is P(y) = 1 N A 1−q A 1−q 2 for q = e i2π py N = 1.

Figure 1 .
Figure 1.Example of a straightforward computation of a continued fraction.Figure 1. Example of a straightforward computation of a continued fraction.

Figure 1 .
Figure 1.Example of a straightforward computation of a continued fraction.Figure 1. Example of a straightforward computation of a continued fraction.

Figure 2 .
Figure 2. Using the Euclidian algorithm to compute a continued fraction.

Figure 2 .
Figure 2. Using the Euclidian algorithm to compute a continued fraction.

Figure 2 .
Figure 2. Using the Euclidian algorithm to compute a continued fraction.

Figure 3 .
Figure 3. Computing the value of a continued fraction based on Equation (5).

Figure 3 .
Figure 3. Computing the value of a continued fraction based on Equation (5).

Figure 4 .
Figure 4. Nesting of the value of a continued fraction by its convergents.

Figure 4 .
Figure 4. Nesting of the value of a continued fraction by its convergents.

Figure 4 .
Figure 4. Nesting of the value of a continued fraction by its convergents.

Figure 5 .
Figure 5.The distance between two succeeding convergents is greater than the distance of a convergent and the value of its continued fraction.

Figure 6 .
Figure 6.The distance between any two convergents is smaller than the distance between vergent with the smaller index and its immediate predecessor.In several calculations, the size of the denominator of a convergent must mated:

Figure 7 2 :
Figure 7 gives the computation of the continued fraction representation of √ 2:

Theorem 11 .
(2nd Kind Best Approximations are Convergents) Let a/b be a best approximation of the second kind of x ∈ R, and let x = [a 0 ; a 1 , • • •] be the continued fraction representation of x.Then a/b is a convergent of x.Proof.Being a best approximation of the second kind of x, a/b satisfies, by definition, |dx − c| > |bx − a| for d ≤ b.Claim 1. a b ≥ a 0 = x 0 .

Figure 9 .
Figure 9. Any best approximation of the second kind is in the grey shaded area, i.e., greater than or equal to the convergent  .

Figure 10 .
Figure 10.If a best approximation of the second kind is not a convergent, it is within the indicated grey shaded areas.

Figure 9 .
Figure 9. Any best approximation of the second kind is in the grey shaded area, i.e., greater than or equal to the convergent x 0 .

Figure 9 .
Figure 9. Any best approximation of the second kind is in the grey shaded area, i.e., greater than or equal to the convergent  .

Figure 10 .
Figure 10.If a best approximation of the second kind is not a convergent, it is within the grey shaded areas.

Figure 10 .
Figure 10.If a best approximation of the second kind is not a convergent, it is within the indicated grey shaded areas.

Figure 13 .
Figure 13.The potential positions of y 0 x.

Figure 16 .
Figure 16.Situation in which a/b is between a convergent and its first semiconvergent (k even).

Theorem 14 .
(Legendre, 1798-Convergent Criterion) Let x − a b < 1 2b 2 ⇒ a/b is a convergent of x.Proof.We show that a/b is a best approximation of the second kind of x.Theorem 11 then proves the claim.Let |dx − c| ≤ |bx − a| for a b = c d and d > 0. We need to prove d > b.Now, |bx − a| = b x − a Figure) is ϕ.

th 2022, 2 ,Figure 17 .
Figure 17.The length of a secant is smaller than the arc of th

Figure 17 .
Figure 17.The length of a secant is smaller than the arc of the corresponding unit circle.

2 where
(A) uses Euler's formula, (B) is the definition of the modulus of a complex number with Re = 1 − cos ϕ and Im = −sin ϕ, (C) is the double-angle formula, and (D) assumes that sin ϕ 2 ≥ 0. To estimate a lower bound for sin ϕ 2 , we analyze the function f (x) = sin x − 2x

Figure 20 .
Figure 20.Determining the interval of succeeding multiples of p enclosing a multiple of N. Furthermore, two different multiples of N are in different intervals defined by succeeding multiples of p. Otherwise, the situation of Figure 21 would imply that  ≤ , which is a contradiction as shown by the proof of Note 9 below.

Figure 21 .
Figure 21.No two multiples of N can be enclosed by succeeding multiples of p.

Figure 19 .
Figure 19.Multiples of N are enclosed by immediately succeeding multiples of p.

Figure 19 .
Figure 19.Multiples of N are enclosed by immediately succeeding multiples of p.

Figure 20 .
Figure 20.Determining the interval of succeeding multiples of p enclosing a multiple of N

Figure 21 .
Figure 21.No two multiples of N can be enclosed by succeeding multiples of p.

Figure 20 .
Figure 20.Determining the interval of succeeding multiples of p enclosing a multiple of N. Furthermore, two different multiples of N are in different intervals defined by succeeding multiples of p. Otherwise, the situation of Figure 21 would imply that N ≤ p, which is a contradiction as shown by the proof of Note 9 below.

Figure 19 .
Figure 19.Multiples of N are enclosed by immediately succeeding multiples of p.

Figure 20 .
Figure 20.Determining the interval of succeeding multiples of p enclosing a multiple of N

Figure 21 .
Figure 21.No two multiples of N can be enclosed by succeeding multiples of p.We denote a  with ( − 1) ≤  ≤  by   .This is justified by the nex which proves that such a  is uniquely determined by .Especially, a multip contained in "its" interval:

Figure 21 .
Figure 21.No two multiples of N can be enclosed by succeeding multiples of p.

Figure 22 .
Figure 22.A multiple of N is always "close" to a multiple of p.Figure 22.A multiple of N is always "close" to a multiple of p.

Figure 22 .
Figure 22.A multiple of N is always "close" to a multiple of p.Figure 22.A multiple of N is always "close" to a multiple of p.More precisely: Note 11. ∀k ∈ N∃t ∈ N : |(t − 1)p − kN| ≤ p 2 ∨ |tp − kN| ≤ p 2 .

Figure 26 .
Figure 26.How the main results of the paper relate.