If you want to know exponents for primes in whatever finite set, then valuation()
function can do that for you. In your example, knowing that the number has no prime factors greater than 101, one can get factorization of such number N
as
L = [ (p,d) for p in primes(2,102) if (d:=valuation(N,p)) > 0 ]
The list L
here contains pairs (prime, exponent) for all primes ≤101 dividing N
. If one wants an actual Factorization
object for N
, then it can be obtained as
Factorization( L )