Given a rational number t and a prime p, decomposeFraction(p,t) returns a list {a,b,c} of integers, with b and c nonnegative, such that t = a/(pb(pc-1)).
i1 : decomposeFraction( 3, 4/45 ) o1 = {64, 2, 4} o1 : List |
i2 : 4/45 == 64/( 3^2 * ( 3^4 -1 ) ) o2 = true |
If the denominator is a pure power of p, then t = a/pb and the function returns c = 0. See the option NoZeroC to avoid this.
i3 : decomposeFraction( 3, 4/27 ) o3 = {4, 3, 0} o3 : List |