I want to calculate:
let n1 = BigInt(256);
let n2 = BigInt(1024);
let n3 = BigInt(3);
let n4 = BigInt(40);
let res = n1.pow(n2.pow(n3) * n4);
let len = res.to_string().len();
I tried num crate, but its pow() method only supports u32 as exponent. Is there any crate that supports BigInt as exponent? Or is it just too big to be calculated?
Not an answer for the
BigInt.pow(&BigInt), but only an answer to this specific problem. This question in this post is "How many digits does this number have?" and it can be converted to a math problem.First simplify this expression.
And "how many digits" can be calculated by "log(10, X)" for decimal number.
Which can be calculated easily. And the result is approximately
103433118919.34569.