Sunday, March 13, 2016

arithmetic - Detecting that a fraction is a repeating decimal



Given any fraction where both the numerator (N) and denominator (D) are both positive and are both whole numbers.




Without manually dividing N by D, is it possible to pre-determine if the resulting value represented in decimal would be a repeating value? (e.g. 44÷33 is 1.3333333333....)



I believe the value of N ÷ D will NOT be a repeating decimal if and only if D is any of the following




  1. D is equal to 1
    OR

  2. D's prime factors only consist of 2's and/or 5's. (includes all multiples of 10)




Otherwise, if none of the two rules above hold true, then the positive whole numbers N and D will divide into repeating decimal.



Correct, or am I missing a case?


Answer



Correct.



From wikipedia:




A decimal representation written with a repeating final 0 is said to terminate before these zeros. Instead of "1.585000…" one simply writes "1.585". The decimal is also called a terminating decimal. Terminating decimals represent rational numbers of the form $k/(2^n5^m)$.





http://en.wikipedia.org/wiki/Repeating_decimals


No comments:

Post a Comment

analysis - Injection, making bijection

I have injection $f \colon A \rightarrow B$ and I want to get bijection. Can I just resting codomain to $f(A)$? I know that every function i...