Re: Cyclical Decimal Expansion
- To: mathgroup at smc.vnet.net
- Subject: [mg114420] Re: Cyclical Decimal Expansion
- From: cjay <christian.jay at noos.fr>
- Date: Sat, 4 Dec 2010 06:11:38 -0500 (EST)
if p/q is irreducible : cycleLength[p_, q_] := Module[{n = 1}, If[q/(2^IntegerExponent[q, 2]* 5^IntegerExponent[q, 5]) == 1, 1, While [Mod[p (10^n - 1), q] != 0, n++] ]; n]