The Journal of Accounting and Management, Vol 5, No 1 (2015)
A Study of Continued Fractions Using Software Tools – I
Cătălin Angelo IOAN 1, Alin Cristian IOAN 2
Abstract. The paper treats some properties of continous fractions using appropriate software.
Keywords: continous fractions, prime numbers
1 Introduction
We call continued fractions a number which has the expression:
where a0Z, aiN* i1.
We shall write: = .
With Euclid’s algorithm every rational number has as a finite representation like a continued fraction. Because, for Q, if an2: = = we shall consider the shorter decomposition for therefore the first expression.
We shall remind, in what follows, from the [2], the principal properties of continous fractions.
Let note n= - the convergent of of order n and n= , (pn,qn)=1. pn and qn are called the continuants of of order n.
It is easly to see that:
, n1
where: p-1=1, p0=a0, q-1=0, q0=1.
After these definitions and notations, we have:
therefore:
from where:
It is easly to see that:
spn
is increasing, but
is decreasing, but
After the last statement we can see that any convergent is closer to the value of the continued fraction than any other rational whose denominator is less than that of the convergent.
Also, the theorem of Lagrange states that any quadratic irrational (that is a number which is root of an equation of second degree with discriminant not perfect square) has a periodic development as continued fraction, that is:
=
which means that an+1=ak, an+2=ak+1 and so on.
The reciprocal is also true.
2 Solving algebraic equations with the aid of continuous fractions
Let now the polynomial PZ[X] and the equation P=0. First, we isolate the roots in intervals with whole ends. Let, for example: x1(a0,a0+1), a0Z. It is not necessary to have only one root in this interval.
The associate Taylor polynomial is:
R
Therefore:
If we find 1 such that: that is:
the root x1 belongs in the interval: .
Using the Horner’s diagram, the computations are organized as follows, for P=cnXn+...+c0
-
cn
cn-1
...
c2
c1
c0
a0
cn
bn-1
...
b2
b1
...
...
...
...
...
...
...
...
...
...
The new diagram has new coefficients:
-
...
If at a step we find two or more such that it follows that in the interval (a0,a0+1) belongs more than one roots of the ploynomial.
3 Numbers expressed like ratio between prime numbers
All over in this paper, the software presented was written in Wolfram Mathematica 9.0.
Let now a number rQ*+, r= where pk – is the k-th prime number.
First, we will inquire into the existence of a development in continued fraction where all terms are primes or 1.
The next software find the development with maxim length for first 2000 prime numbers.
Clear["Global`*"];
numberprimes=2000;
nr=0;
For[k=2,knumberprimes,k++,For[s=1,sk-1,s++,x=Prime[k]/Prime[s];
a=ContinuedFraction[x];b=1;For[p=1,pLength[a],p++,x=Part[a,p];If[PrimeQ[x]||x== 1,b=b,b=0*b]];If[b==1,nr=nr+1;If[nr==1,c=a;d=k;e=s,If[Length[a]>Length[c],c=a;d=k;e=s]]]]]
Print[d,"---",e,"---",Prime[d],"/",Prime[e],"=",c]
The result of the execution is:
1430---1158---11933/9349={1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2}
which means that = =[1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2].
If we shall find the development in continued fraction where all terms are primes we find:
Clear["Global`*"];
numberprimes=2000;
nr=0;
For[k=2,knumberprimes,k++,For[s=1,sk-1,s++,x=Prime[k]/Prime[s];
a=ContinuedFraction[x];b=1;For[p=1,pLength[a],p++,x=Part[a,p];If[PrimeQ[x],b=b,b=0*b]];
If[b==1,nr=nr+1;If[nr==1,c=a;d=k;e=s,If[Length[a]>Length[c],c=a;d=k;e=s]]]]]
Print[d,"---",e,"---",Prime[d],"/",Prime[e],"=",c]
and the result of the execution is:
1271---613---10357/4517={2,3,2,2,2,2,2,2,3,2}
which means that = =[2,3,2,2,2,2,2,2,3,2].
If we shall find the development in continued fraction where all terms are different primes we find, for first 5000 prime numbers:
Clear["Global`*"];
numberprimes=5000;
nr=0;
For[k=2,knumberprimes,k++,
For[s=1,sk-1,s++,x=Prime[k]/Prime[s];
a=ContinuedFraction[x];b=1;
For[p=1,pLength[a]-1,p++,
x=Part[a,p];
If[PrimeQ[x],
For[i=p+1,iLength[a],i++,
y=Part[a,i];
If[PrimeQ[y],
If[x== y,Goto[salt]],Goto[salt]]],Goto[salt]]];
If[b==1,nr=nr+1;If[nr==1,c=a;d=k;e=s,If[Length[a]>Length[c],c=a;d=k;e=s]]];
Print[k,"---",s,"---",Prime[k],"/",Prime[s],"=",a];
Label[salt]]]
Print["Maximum length is for: ",d,"---",e,"---",Prime[d],"/",Prime[e],"=",c]
and the result of the execution is:
Maximum length is for: 3636---1335---33961/10993={3,11,5,7,13,2}
which means that = =[3,11,5,7,13,2].
In what follows we shall try to find the numbers rQ*+, r= where pk – is the k-th prime number, r= for which the reverse: s= is also of the form: s= .
Clear["Global`*"];
numberprimes=2000;
nr=0;
For[k=2,knumberprimes,k++,
For[s=1,sk-1,s++,x=Prime[k]/Prime[s];
a=ContinuedFraction[x];
lung= Length[a];
c=a;
For[p=1,plung,p++,
c[[p]]=a[[lung+1-p]]];
value=FromContinuedFraction[c];
If[PrimeQ[Numerator[value]]&&PrimeQ[Denominator[value]],nr=nr+1;If[nr==1,t=a;d=k;e=s,
If[Length[a]>Length[t],t=a;u=c;d=k;e=s]]]]]
Print[d,"---",e,"---",Prime[d],"/",Prime[e],"=",t," and reverse:", Numerator[FromContinuedFraction[u]],"/",Denominator[FromContinuedFraction[u]],"=",u]
We found the maximum length for the first 2000 prime numbers:
1400---871---11657/6763={1,1,2,1,1,1,1,1,1,1,3,1,1,1,1,1,2}
and reverse: 11657/4447={2,1,1,1,1,1,3,1,1,1,1,1,1,1,2,1,1}
that is: = =[1,1,2,1,1,1,1,1,1,1,3,1,1,1,1,1,2] and the reverse development is: =[2,1,1,1,1,1,3,1,1,1,1,1,1,1,2,1,1], both 11657 and 4447 being primes.
4 References
Adler A., Coury J.E. (1995), „The Theory of Numbers”, Jones and Bartlett Publishers International, London, UK
Baker A. (1984), „A Concise Introduction to the Theory of Numbers”, Cambridge University Press
Coman M. (2013), „Mathematical Encyclopedia of Integer Classes”, Educational Publishers
Guy, R,K, (1994), „Unsolved Problems in Number Theory”, Second Edition, Springer Verlag, New York
Hardy G.H.., Wright E.M. (1975), „Introduction to the Theory of Numbers”, Fourth Edition, Oxford University Press
Krantz S.G. (2001), „Dictionary of Algebra, Arithmetic and Trigonometry”, CRC Press,
Niven I., Zuckerman H.S., Montgomery H.L. (1991), „An Introduction to the Theory of Numbers”, Fifth Edition, John Wiley & Sons, Inc., New York
Sierpinski W. (1995), „Elementary theory of numbers”, Second Edition, Elsevier
Wai Y.P. (2008), „Sums of Consecutive Integers”, arXiv:math/0701149v1 [math.HO]Talvi Ernesto, Vegh A. Carlos (2005), Tax base variability and procyclical fiscal policy in developing countries, Journal of Development Economics 78, pp. 156– 190
1 Danubius University of Galati, Department of Finance and Business Administration, catalin_angelo_ioan@univ-danubius.ro
2 Nicolae Oncescu College, Braila, alincristianioan@yahoo.com
Refbacks
- There are currently no refbacks.
This work is licensed under a Creative Commons Attribution 4.0 International License.