Hardy & Wright "Intro to the theory of numbers" chapter 9 is on this topic. Assume gcd(P,Q)=1. thm 135: P/Q has terminating or eventually-periodic expansion. If gcd(Q,R)=1 then periodic, otherwise terminating. The period length is the order of R mod Q. So, the conjecture that 1/Q where Q is "the first prime greater than 10^n" will have period exceeding 10^n is undoubtably false eventually, in fact 10 should presumably be a square mod Q eventually about half the time so it should be false at least half the time. You can check that P/Q with Q prime will have maximum period in radix R by computing the order of R mod Q and verifying it is Q-1, which you need to do by computing R^((Q-1)/d) mod Q for each divisor d of Q-1, and verifying none of these are 1. The idea that we can identify numbers like 1.004009016025036... by use of "generating functions" is silly in comparison with the much better and simpler idea that you can find the optimum rational approximations to ANY decimal X by use of (Euclid's) continued fraction expansion of X: 1.004009016025036049064081100 = [1, 249, 2, 3, 1, 1, 14, 7, 4, 2, 4, 7, 7, 1, large] then 1 + 1/(249+1/(2+1/(3+1/(1+1/(1+1/(14+1/(7+1/(4+1/(2+1/(4+1/(7+1/(7+1)))))))))))); = 1001000000 / 997002999 = 1.004009016025036049064081100121144169196225256289324361... Marsaglia suggested an actual use for all this, which is that the radix R expansion of some rational P/Q with huge period could provide a good and efficient pseudorandom number generator. It is possible by clever choice of P,Q,R to obtain huge periods (e.g. of order 2^500) but with no explicit use of multiprecision arithmetic. These go under the names "Marsaglia/Zaman add-with-carry, subtract-with-borrow, and multiply-with-carry" generators and they are implemented with extremely simple recurrences that effectively implement division of a huge multiprecision number by Q but because of the ultrasparse binary structure of the particular Q he chooses (and in some versions one can generate the quotient "backwards" too) this is easy. As the radix R, Marsaglia uses either 2^wordsize or 2^wordsize-1. As Q, Marsaglia uses a prime of the form Q=a*R^k-1 chosen so that R is a primitive root mod Q or anyhow having as large multiplicative order as possible. As P, pretty much any gunk filling an array of k machine words, will do. Actually, now that I am looking at this, http://en.wikipedia.org/wiki/Multiply-with-carry it occurs to me there ought to be a more general idea: Instead let Q be a prime of form a*R^k-b for integers a,b that fit well within one machine word, such that R has multiplicative order as large as possible mod Q. I think the recurrence-system instead will then be x[n] = (a * x[n-k] + c[n-1]) mod R c[n] = floor( (a*x[n-k] + b*c[n-1]) / R ) for n=k,k+1,k+2,... When implementing, x of course does not need to be an infinite-length array, but only with k entries since you can "wrap" it mod k, and c does not need to be an array at all, only a single machine word. As the math-funners have pointed out, though, certain Q lead to rather ridiculously obviously-nonrandom sequences (expansions of 1/Q mod R), albeit that is disguised to a considerable degree by the fact we are computing P/Q not 1/Q and P is made of truly-random "seed" bits. Any such generator is going to fail a "continued fraction test" of randomness almost instantly. This objection is defeated by: I also once invented a way to do the usual linear congruential generator x <-- (A*x+B) mod M to get huge periods without explicit use of multiprecision arithmetic, but it is considerably more complicated than Marsaglia's idea, although also quite efficient and probably "more random." My idea was to carefully choose M to be a prime of the form 2^a+-2^b+-1 where a and b are multiples of the computer wordsize; A is chosen to be a "sparse" multiprecision (a words long) number which happens to be a primitive root mod M. The sparsity structure of A is carefully selected to try to get both computational efficiency and fast graph-theoretical "expansion."