Abstract
This paper continues the author’s previous studies on continued fractions and Heron’s algorithm, as from his former JMM2017 presentation (see [5]).
Extending the notion of continued fraction to the adic fields, one can find continued fractions which converge in both real and adic topologies to the “same” quadratic irrational number, some of which are given by the Heron’s algorithm using a generalized version of an author’s theorem from the cited JMM presentation. The definition can be possibly generalized to other global fields, as left as an open question. We will end the part on hybrid convergence with many numerical examples. After that, we will recall the basic algorithms on the adic fields studied by the author and see some applications of theirs to computer science: applying Heron’s algorithm to quickly compute adic square roots, finding new elementary cryptography procedures and some methods to get pseudorandom numbers, calculate last digits of some peculiar very big numbers.
1 Introduction
Heron’s algorithm is very important in history of mathematics, and is a particular case of Newton’s method for approximating zeroes of a function. We will recall in this work a theorem on Heron’s algorithm related to continued fractions proved in [5]. The theorem will also hold for a generalization of continued fractions (definition 2.1) which converges also in local adic completions (for every prime divisor of a fixed natural squarefree number ), in the wake of the author’s previous work (see PhD thesis [9]). After recalling Lagrange’s theorem for quadratic irrationals, we will see that some of them have a common representation both as real and adic ( as before) numbers. We must recall that Heron’s algorithm is also very important in adic fields, where Newton’s method is better known as the fundamental Hensel’s lemma and gives a very fast algorithm for computing the adic square root (compare [8]). Other generalizations of continued fractions may be studied for such hybrid convergences, and this is left as an open problem. In the end of the section we will leave an open question over possible generalizations of the definition to other fields and then give some numerical examples of the hybrid convergence in the generalized definition given here. In the last section we will see applications of general adic algorithms, such as pseudorandomizing methods (see [11], [12]) and fast computation of the last decimal digits for some “unimaginable numbers” (see [6]).
This work has been presented both at “The First Symposium of the International Pythagorean School – da Pitagora a Schützenberger: numeri inimmaginabilîîî” held in Cosenza, Italy (september 2018) and at the JMM 2019 held in Baltimore, MD.
1.1 adic fields and adic rings
Given a prime number , the set of adic integers can be represented as a power series in the letter with exponents growing towards and digits in a finite set of elements, generally . More generally, one can allow to be any given integer .
For instance, the number can be represented in the adic ring as:
because indeed one expects that (as we will see in the “adic algorithms” section):
In the prime case one obtains a field , which is the completion of rational numbers under the socalled adic absolute value. The latter is defined for a fraction (for uniquely determined , not divisible by ) as:
so that in fact positive powers of converge to .
In the general case is a ring with the following properties:

for any by writing all digits of the first ring in base .

when and are coprime as approximants converge in both rings, giving this way the two projections, and the map is invertible by chinese remainder theorem.

Thus considering all prime divisors of . As a side fact, when the ring has always zerodivisors.
Structure of the multiplicative group is discussed in [9].
Example 1.1.
Hexadecimal representations of bits colors is just a shortened version of the actual bit representation:
Example 1.2.
Let’s see an example of a decimal zerodivisor (as explained in the “last digits of unimaginable numbers” section):
1.2 Heron’s algorithm and Newton’s method
The Newton’s method for finding the roots of a polynomial consists in starting with an approximation of such a root, drawing the tangent at the point to the graph and intersecting this tangent with the axis, obtaining ; the sequence obtained by this method converges to a root of the polynomial.
When one considers the polynomial and starts with , Newton’s method just sends to the arithmetic mean between and and is known as the Heron’s algorithm
for finding (the geometric mean)
. The intervals between and give a socalled sequence of chinese boxes.We recall the main theorem from [5]:
Theorem 1.3 (Al 2017).
Suppose has (classical) continued fraction expansion with period of length or . Apply Heron’s algorithm to obtaining a sequence . Then is the th approximant via the continued fraction. Vice versa, if the continued fraction has period length greater than , applying in the same way Heron’s algorithm one does not get the same sequence of approximants.
2 Continued fractions which converge in different absolute values
It is possible to define continued fractions in such a way that they converge in , but the definition is far from being unique and often depends on the results one wants to achieve (apart from author’s work, see also [2] and [3]). We will now consider a definition which ensures convergence for more than just one absolute value. Heron’s algorithm in adic fields will be a particular case of Hensel’s lemma.
Definition 2.1.
We will consider a nonzero integer , which is specifically the product of different primes (). Then we may consider expressions of the form:
where we consider integers such that and (inequality is obviously strict when from the coprimality condition). We may accept not to be restricted to values greater than as one does with usual continued fractions. We remark that continued fractions are the classical ones, while continued fractions are the almostclassical ones obtained using the “ceiling” integral part.
Theorem 2.2.
The continued fraction defined above converges with respect to the adic absolute value for any prime dividing and also with respect to the usual absolute value in the real numbers.
Proof 2.2. With the usual methods for continued fractions in local fields (see [9]) one can prove that it converges in all adic fields (indeed, fixed a prime, the other primes dividing are invertible in so can be moved to the denominator of the fractions), or equivalently in the adic ring . Moreover, we have:
and this gives the convergence in the set of real numbers in a way analogous to the standard continued fractions.
As a brief recall, we consider the recurrence step for the approximants :
from which we get the following facts:

the denominator recurrence is necessarily exponentially divergent ();

the difference of two consecutive approximants is as well exponentially convergent to zero because simple calculations give:

thus, the sequence of approximants satisfies Cauchy’s condition and converges to a uniquely determined real number.
The following results are straightforward:
Proposition 2.3.
Theorem 1.3 about Heron’s algorithm holds also for adic continued fraction expansions. Specifically, the proof is the same without supposing being an integer and considering the expansion. More precisely, given a nonsquare positive integer , the fact that has a hybrid continued fraction expansion of the form is necessary and sufficient condition for each to be the th approximant via the continued fraction.
Proposition 2.4.
Periodic hybrid continued fractions converge to the “same” algebraic (quadratic) number for each absolute value which is considered, meaning that it is the solution of the same degree equation over .
We conclude this section with some numerical examples after the following:
Remark 2.5.
Continued fractions may be considered also in other global fields and their completions (for instance with Gauss integers and complex numbers), with the due attentions. An interesting open question may be whether there is a similar hybrid convergence theory in such cases.
2.1 Examples

The first example is ; a simple calculation shows that meaning that subtracting we obtain a square root of . It converges in both the usual real absolute value and in the adic one. Also, is an integral part for both in the real field and in as modulo . Thus the Heron’s algorithm gives the continued fraction approximants (and consequently converges) in both cases:

We give another perfectly similar example. We take , whose radical part has Heron’s approximants:

In the following example we consider a simple composite , i.e. . Here we have with first approximants in . Here it is not possible to have a square root without denominator so we can’t relate to the Heron’s algorithm of the square root of an integer.

In the case we may have instead an integral expression such as which converges in . This expression relates to Heron’s algorithm for :

We conclude this part with a length2 period case. We take , whose radical part has Heron’s approximants:
3 adic algorithms and applications
Calculations with adic numbers can be used for cryptography and for generating random numbers, as we will see in this section.
3.1 Basic results
Remark 3.1.
In the case of adic fields, and more generally adic rings (where is not necessarily a prime number) the equivalent of Newton’s approximation method of tangents is known as one of the most important theorems under the name of Hensel’s lemma. Thus the convergence of Heron’s algorithm can be studied using well known results about Hensel’s lemma, and one finds out that a precision of is always achieved within steps. Thus it has applications to adic computations, where it is indeed a very fast algorithm for computing the square root of a number (compare corollary 4.2.3 from [8]).
We recall that adic numbers, and more in general adic numbers for any given integer , can be represented as a power series in the letter (or ) with exponents growing towards and digits in a finite set of (or ) elements, generally (the same as real numbers, but with possibly infinite digits only on the left of the decimal point, reflecting the different convergence). In this setup, we can implement algorithm for calculation with the following proposition (see [8]):
Proposition 3.2.
The fundamental operations (addition, opposite, multiplication, reciprocal) can be turned into an easy algorithm for calculations into the set “adically approximated to the th digit” by the projection (or truncation) into , i.e. modulo any element with adic absolute value less than . A similar result holds for adic rings, given any integer . The algorithms can be (and have been by the author) implemented on a computer.
Moreover:
Proposition 3.3.
Any advanced operation which requires approximations by Hensel’s lemma (provided that the input satisfies lemma’s hypothesis) can be as well implemented as an algorithm, as already done by the author.
Some common examples are:

quadratic surds;

exponentials and logarithms (or other functions determined by a power series) within their convergence radius.
3.2 Elementary criptography methods
Let us consider the strings of elements in the set , i.e. elements of . Fixing an element (it suffices that the last digit is coprime to ), this determines a simple symmetric encrypting key by normal adic multiplication:
where the decrypting key is simply . It is likely that our further studies of these kind of algorithms will lead us to better encryption methods.
Example 3.4.
Decimal numbers from to can be encrypted using the key , which has as a reverse key the number by the well known peculiar factorization .
Example 3.5.
Alphanumeric strings can be considered as adic numbers with digits (the last being a separator) and therefore encrypted using the properties of .
Example 3.6.
Using bitmapped bases, we may as well consider the possibility to apply our cryptography methods to such expressions.
We know that using basis (which corresponds to representing digits with a black and white bitmap), or any other power of
, a number is invertible if and only if the last digit is odd; the only possible issue in the division algorithm is effectively calculating the reciprocal of this last digit, but this can be done by considering for this digit the
adic expansion and applying adic division.Representing digits as b/w bitmaps has many possible practical applications, as the technology to let an electronic device read such digits is already widespread (barcodes, QRcodes).
3.3 Randomizing algorithms
We can try the following randomizing methods given a seed (and ignoring trivial endings):

transforming continued fractions into sums and viceversa (digits );

considering or other converging power series;

iterating times the function in any adic ring.
Indeed, the operation of going from natural numbers to adic numbers and viceversa is totally unpredictable and as such satisfies the 3rd law of randomness (see [12]).
Remark 3.7.
The Montecarlo method for calculating a probability, which is used in physics abundantly, can be used in reverse to verify that an experiment is random enough. Instead of determining the average value of the outcomes for an experiment in order to get an approximated expected value of its distribution, one checks that the known expected value is comparable with the statistically obtained one. We will specifically use the fact that in an
square the probability to have a distance from a corner less than is approximately .We consider the third possibility, applying our fast algorithm for computing square roots. We show some heuristic data giving credit to the fact that it generates pseudorandom digits.
We start by creating a list of random couples with and . Grouping together of those couples, we count how many satisfy , and multiply the ratio by .
We iterate times this procedure and obtain a statistic with average
and variance
, confirming the pseudorandomness of the algorithm by the 3rd law of pseudorandomness (cannot be distinguished from a random one by a chosen method).3.4 Last digits of “unimaginable numbers”
For some socalled “unimaginable” numbers (see [6]), like Graham’s number, we may calculate the last digits using adic numbers.
Example 3.8.
In there are two non trivial idempotent elements (whose sum is and product is ) given by:
Their last digits are in common with the unimaginable numbers and , given that is big enough to justify the “unimaginable” attribute.
We recall that the Graham number is defined in Knuth’s notation (see [6] for a wide discussion on hyperoperations) by the following recursive notation:
This literally unimaginable number was involved in the first proof for Graham’s problem in Conway’s theory, even though it has been recently substituted by the smaller (but still insanely big) number .
Example 3.9 (Last digits of Graham’s number).
We now consider the problem of computing the last digits of .
It can be proved that the following algorithm:
converges in and that also exists and .
This number can be seen to be the fixed point for the equation .
Observing that the adic difference ends with an “unimaginable” number of zeroes, their last digits are the same for all practical purposes.
Remark 3.10.
More generally, an infinite tetration always converges in any adic ring (see also [14]), as it must converge for any adic value: either divides , thus the sequence converges to , or they are coprime and the convergence is similar to the one of continued exponentials (see [9]).
This number too can be viewed as a fixed point:
This is of course a generalization for .
Acknowledgements
I want to thank my family and friends for supporting me, and also my former advisor R. Dvornicich for his suggestion on participating to JMM. Also a thank goes to my research funder G. d’Atri for his suggestions and support on this work.
This work has been partially supported by POR Calabria FESRFSE 2014–2020, with the grant for research project “IoT&B”, CUP J48C17000230006.
References
 [1]
Comments
There are no comments yet.