A problem of decimals.. The exact problem:
For any natural number n>1, write the infinite decimal expansion of $\frac{1}{n}$ (for example, we write 1/2 = $0.4\overline9$ as it's infinite decimal expansion, not 0.5). Determine the length of the non periodic part of the (infinite) decimal expansion of $\frac{1}{n}$
I do not see how it is possible to do this in generality, I think that this may have something to do with primes, although I can't figure it out.. also if this is in generality then what about numbers like $\frac{1}{11}$? which do not have nice expansions? Help appreciated!
 A: I'm going to re-write this in a few hours.  The following is correct but I think I can explain it much cleaner, clearer and neater.  But... I have things to do right now.
New answer in a few hours.
======
Let's call that number $h(n)$.  $h(10^k*n) = h(n)+ k$.  We are dividing 1/n by $1/10^k$ which adds $k$ zeroes.
If $n = 2^j$ or $n= 5^j$ then the answer is $j$.  Because $n | 10^j$ but doesn't divide into any lower power of 10. 
If neither $2$ nor $5$ divide into $n$ then $h(n) = 0$.  In finding the decimals you are taking remainders, multiplying them, and dividing by n.  There are only a finite number of remainders possible so eventually the string will repeat.  But when it does:  $10R = q*n + r$.  Not only is the next remainder forced, so is the previous remainder.  So the pattern can only repeat from the very begining.  (This isn't the case for $m/n$ the first remainder is m*10 = q*n + r; the first term being m rather than 1, puts an "artificial" beginning.) 
The final case is $n = 2^km$ or $n = 5^km$; $m$ not divisible by 2 or 5.  In that the answer is $k$ .  This is because $1/n = 1/m*1/(2or5)^k$. $1/m$ will have no nonrepeating part and $1/(2or5)^k$ will have $k$ nonrepeating part. 
==== Draft of new answer =====
Pre-script: I'm not going to worry about converting a terminating decimal into a decimal with trailing 9s.  If the terminating decimal has n terms, the last term is non-zero.  Converting it to one with trailing 9s will result in n non-repeating terms.  This is exactly the same as the number of non-repeating terms had we left it as a terminating decimal.
Let's refer to the number of non-repeating digits of $1/n$ as $h(n)$.
If $n = 2^j5^km$ then $h(n) = \max(j,k)$.
Case 1: Neither $2$ nor $5$ divides $n$.  Then $n = 2^05^0m$ and $h(n) = 0$.
Pf:
When we calculate the digital expansion of $1/n$ we do a series of calculations:
$10*r_{i - 1} = n*q_i + r_i; 0\le r_i < n$
we start with:
$1 = 0*n + 1; q_0 = 0; r_0 = 1$
The final decimal expansion is $q_0.q_1q_2q_3....$.
A few things to note:
$10*r_{i - 1} = n*q_i + r_i; 0\le r_i < n; q_i, r_i \in \mathbb Z^+$
$r_{i-1} < n$ so $10*r_{i-1} < 10*n$ so $q_i < 10$ so this does give us decimal digits.  (Just in case you were worried.)
Second: as $n \not | 10^k$ for any $k$ this process will never terminate.  (If we ever get a remainder of 0, that would mean $n*10^{-k}$ divides evenly into 1 or, equivalently, $n | 10^k$.)
As $r_i < n$ there are only a finite number of values for $r_i$ so eventually the series of remainders will have a duplicate $r_j = r_k$ even though $j < k$.
But if $r_j = r_k$ then $10*r_j = 10*q_{j+1} + r_{j+1}$ will have the same solutions as $10*r_k = 10*q_{k+1} + r_{k+1}$.  Hence $q_{j+1} = q_{k+1}$, and inductively, there will come a point where the decimal repeats infinitely.
Finally note.  given $q_l$ and $r_l$ we can determine $n*q_l + r_l = 10*r_{l - 1}$ so we can determine the values of the remainders back to the first equation.  That means the infinitely repeating sequence of decimals begins at the very begining, $q_1$.
So $h(n) = 0$.
(Note: For $m/n; m \ne 1$ the first equation is $m = q_1*n + r_1$ which is a different start.  Eventually the remainders, and thus the decimal digits, will repeat infinitely, but when we calculate back we won't go back to the very beginning.  So $m/n$ [$n$ not divisible by 2 or 5] can very well have a non-repeating decimal part although $1/n$ can not.)
Case 2:
$n = 2^j5^k$ then $h(n) = \max(j,k)$.
Pf:  Let $l = \max(j,k)$.  $2^j5^k | 10^l$.  ($n = $ either $2^{j-k}10^k;l =j$ or $n = 5^{k-j}10^j;l = j$.)
Let $10^l = m*n$.  ($m = 2^{l - j}5^{l-m}$ which is $2^{k-j}$ if $l = k$ or $5{j-k}$ if $l = j$.)
So $1/n = m/10^l$.  As with any integer, if $m = a_1a_2...a_s$ and $a_s \ne 0;s < l$,  $m/10^l = 0.(000...)a_1a_2....a_s$. which has $l$ digits before it terminates.
So $h(2^j5^k) = \max(j,k)$.
