Given a rational number t and a prime p, decomposeFraction(p, t) returns a sequence (a,b,c) of integers, with b and c nonnegative, such that t = a/(pb(pc-1)).
i1 : (a, b, c) = decomposeFraction(3, 4/45) o1 = (64, 2, 4) o1 : Sequence |
i2 : 4/45 == a/(3^b * (3^c - 1)) o2 = true |
If the number t is of the form a/pb, then the function returns (a,b,0). Setting the option NoZeroC => true forces the third entry of the output sequence to be nonzero, even if that means increasing the first entry.
i3 : decomposeFraction(3, 4/27) o3 = (4, 3, 0) o3 : Sequence |
i4 : (a, b, c) = decomposeFraction(3, 4/27, NoZeroC => true) o4 = (8, 3, 1) o4 : Sequence |
i5 : 4/27 == a/(3^b * (3^c - 1)) o5 = true |