in benchmarks/src/gatling/scala/org/apache/polaris/benchmarks/NAryTreeBuilder.scala [56:63]
def depthOf(ordinal: Int): Int = {
if (ordinal == 0) return 0
if (nsWidth == 1) return ordinal
// Using the formula: floor(log_n((x * (n-1)) + 1))
val numerator = (ordinal * (nsWidth - 1)) + 1
(math.log(numerator) / math.log(nsWidth)).floor.toInt
}