|
-
May 11th, 2008, 02:28 PM
#1
Thread Starter
Addicted Member
Recurring Decimal
lets say we have
x = 1/7
x = 0.142857 142857 142857 142857
the recurring cycle in this decimal is 142857
is there anyway to find this, or at least the length of it?
for example, if x = 1/7 >> y = 142857
I don't want a code, I want a method...
Thanks
Im using Visual Studio 2008 Professional Edition
.Net Framework 3.5
-
May 11th, 2008, 03:28 PM
#2
Re: Recurring Decimal
Have a look on wikipedia:
http://en.wikipedia.org/wiki/Recurring_decimal
Quite interesting tbh, although I never thought about it before.
From the wikipedia site:
From this kind of argument, we can see that the period of the repeating decimal of a fraction n⁄d will be (at most) the smallest number k such that 10 k − 1 is divisible by d.
For example, the fraction 2⁄7 has d = 7, and the smallest k that makes 10 k − 1 divisible by 7 is k = 6, because 999999 = 7 × 142857. The period of the fraction 2⁄7 is therefore 6.
In the case of a prime denominator (exluding 2 and 5) such as (1/p) , the period (number of digits in the recurring 'sequence') is always (p-1) or a divisor of (p-1).
For example, 1/7 = 0.142857... which has 7-1 = 6 recurring digits.
For example, 1/13 = 0.076923… which has (13-1)/2 = 6 recurring digits.
I don't know how you can decide (with 1/13 for example) if it's (13-1) or (13-1)/n though...
-
May 12th, 2008, 04:46 AM
#3
Re: Recurring Decimal
 Originally Posted by NickThissen
In the case of a prime denominator (exluding 2 and 5) such as (1/p) , the period (number of digits in the recurring 'sequence') is always (p-1) or a divisor of (p-1).
I just thought I'd point out that this is a result of Fermat's Little Theorem (I had to look it up to make sure it worked ). Even the cases where it doesn't work, 2 and 5, are accounted for since a and p have to be coprime.
As for finding the smallest k... I really have no idea. I never was very good at number theory. You might be able to use Euler's Theorem which happens to be a generalization of Fermat's Little Theorem; perhaps Nick or someone else could help apply it in this case.
The time you enjoy wasting is not wasted time.
Bertrand Russell
<- Remember to rate posts you find helpful.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|