Sorry I have to bother Wolfram Community (maybe, better name’ll be Wolfram Research Community - WRC, imho, cuter then WC :-)) on such an issue. I’m novice in Mathematica, in my project need to decompose the number to the sum of degrees of a given prime number.
Example (need common construction):
103^3==2^20+2^15+2^13+2^11+2^10+2^6+2^5+2^4+2^2+2^1+2^0
Or:
1092727==1048576+32768+8192+2048+1024+64+32+16+4+2+1
Upper degree i need may be found by this function
f2[y1_, y2_] := Catch [Do [If [(y1/y2^i > 1) && (y1/y2^(i + 1) < 1), Throw[i]], {i, 1000}]]
but here is a problem - construction Throw-Catch returns only one value - degree i (for solving problem need, for example, difference: y1-y2^i or smth like it). Imho, if Throw-Catch can return 2 or more values - this construction becomes more strong and interesting. As a variant - divide variables of function in 2 groups - one group of variables - send to the function for calculation, another group - return as a result of calculation. But this idea is too common, need to solve this problem anyway now.