Natural.iroot_k: def of bend-collections-laws-math@1.0.0.0 Import: import bend-collections-laws-math@1.0.0.0/src/math/natural.bend as Natural Lines 235-243 of bend-collections-laws-math@1.0.0.0/src/math/natural.bend: https://jend.leeeet.dev/read.txt?path=bend-collections-laws-math@1.0.0.0/src/math/natural.bend&start_line=235&end_line=243 import Base import bend-collections-laws-math@1.0.0.0/src/math/pow2.bend as P2 # the largest r with r^k <= n (k >= 1) def iroot_k(+n: Nat, +k: Nat) -> Nat: match k: case 0n: 0n case 1n: n case 2n+ +kp: search(n, 2n+kp, 0n, P2.pow2t(1n+Nat.div(bit_length(n), 2n+kp))) Uses (5): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.div https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/src/math/natural.bend&name=bit_length https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/src/math/natural.bend&name=search https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/src/math/pow2.bend&name=pow2t