Zulip Chat Archive

Stream: Is there code for X?

Topic: Highest prime power dividing a nat?


Eric Rodriguez (Aug 02 2021 at 09:13):

is there any better way to get some prime power dividing a nat than:

let mf := (k+2).min_fac,
let pow := nat.log mf (nat.gcd (mf ^ (k+2)) (k+2)),

I'm dealing with Sort* so would rather avoid some and some_spec, but if it's the easiest that's fine too

Kevin Buzzard (Aug 02 2021 at 09:20):

Do you just mean padic_val_nat?

Kevin Buzzard (Aug 02 2021 at 09:21):

Ines was writing some API for it recently. I think this function deserves more love!

Eric Rodriguez (Aug 02 2021 at 09:22):

woo, that's amazing timing!


Last updated: Dec 20 2023 at 11:08 UTC