[Tutor] Finding a repeating sequence of digits

Eike Welk eike.welk at gmx.net
Sat Jan 2 16:09:05 CET 2010


Hello Robert!

On Saturday 02 January 2010, Robert Berman wrote:
> Hi,
>
> I am trying to build an algorithm or methodology which will let me
> tell if a decimal has a repeating sequence of digits 
If you are starting from fractions, I think you have to find the prime 
factors of the denominator. If the denominator contains other prime 
factors than 2 and 5, the fractional part has an infinite number of 
digits. I can't prove it, but here is an illustration:

The fractional part of a decimal number always has the following form:
x/10, x/100, x/1000, ...

If you express them as prime factors it looks like this:
x/(2*5), x/(2*5 * 2*5), x/(2*5 * 2*5 * 2*5), ...

If you have for example:
1/30 = 1/(2*3*5) 

There is no way to remove the prime factor 3 from the denominator. 
Therefore 1/30 can't be expressed with decimal numbers, it can only 
be approximated. 

> and if it does 
> have that attribute, what is the sequence of digits. For example,
> 1/3.0 = 0.333333333..By eyeballing we know it has a repeating
> sequence and we know that the sequence is .3333.....A little more
> complex is 1/7.0 = 0.142857142857 but still is equivalent. A harder
> example is 45/56.0 = 0.8035714285714286. Here we have a repeating
> sequence but it comes after the first three digits.
I believe you have to generate the sequences for all prime factors and 
go from there:
45/56 = 45 / (2*2*2*7) = 45/8 * 1/7 = 5.625 * 1/7

However I have no mathematical background, so I can't be very helpful 
here.  


Eike. 


More information about the Tutor mailing list