Re: [math-fun] Multiplying repeating decimals
I wonder how much of this stuff Mathematica already knows. E.g.: In[265]:= digitCycleLength[r_Rational, b_Integer?Positive] := MultiplicativeOrder[b, FixedPoint[Quotient[#, GCD[#, b]] &, Denominator[r]]] In[270]:= digitCycleLength[1/(10^13 - 1), 10] Out[270]= 13 In[271]:= digitCycleLength[1/(10^13 - 1)^2, 10] Out[271]= 129999999999987 VictorM>Let m be a positive integer relatively prime to 10. Then the period length of 1/m is the multiplicative order of 10 modulo m -- i.e. we look in the group (Z/mZ)*. Note that if p is an odd prime, that even though the multiplicative,a =order of 10 mod p might be small, the multiplicative order of 10 mod p^2 is overwhelmingly likely to be p*a (except when we have something like a Wieferich prime). If m,n are relatively prime, then by the Chinese remainder theorem the multiplicative order of 10 mod mn is the lcm of the multiplicative orders of 10 mod each of m and n. Victor On Mon, Sep 29, 2014 at 5:53 PM, James Propp <jamespropp@gmail.com> wrote: I had assumed that if you multiply an eventually repeating decimal of period m and an eventually repeating decimal of period n, you get an eventually repeating decimal whose period is bounded by some polynomial function of m and n. But today I learned from Henry Cohn that that's not true: the period length can be exponentially large in m and n. More specifically, 1/(10^n-1) repeats with period n, but its square repeats with period 10^n-1 or thereabouts. I'm sure someone has written about the repeat-length for 1/(10^n-1)^2; can anyone provide a reference? Jim Propp Rich> Your intuition isn't completely off base. If the two periods M & N are relatively prime, then the product period should be a divisor of 9MN. This is because 10^M - 1 and 10^N - 1 both divide 10^MN - 1, and if gcd(M,N)=1, then gcd(10^M-1,10^N-1) is 9. The 9 in 9MN provides the required factor of 9, so that (10^M-1)*(10^N-1) divides 10^9MN - 1. This suggests the general period formula is (a divisor of) lcm(M,N) * (10^gcd(M,N) - 1). Rich
participants (1)
-
Bill Gosper