Polynomial-time 2-adic valuation on unary naturals #
Repeated division by two while the current value is positive and even counts the binary trailing
zeros padicValNat 2 n in at most n unary steps, keeping the encoded (value, count) pair
linearly bounded.
Main results #
Turing.MultiTapeTM.ComputableInPolyTime.unary_padicValNat_two:padicValNat 2is polynomial time with unary input and output.
The 2-adic valuation padicValNat 2 is polynomial-time with both input and output in unary.