Closed ganeshkbhat closed 1 year ago
It could ve that the number us too large, try modPow
You probably reached the memory limit. I think the V8 engine will error once you use more than 1 billion bits.
By the way bigInt("3").pow("3005301647874556767787878788787")
is a very huge number, I'm not sure that I would expect the calculation to finish within a human lifetime.
As @Yaffle pointed out, if all you want to do is check divisibility, the modPow
method should be a lot faster.
I am trying this
var n = bigInt("3").pow("300530164787").minus("3").isDivisibleBy("300530164787");
andvar n = bigInt("3").pow("3005301647874556767787878788787").minus("3").isDivisibleBy("3005301647874556767787878788787");
and the node console is all locked up.I am expecting the above to check if
isDivisibleBy(value)
returns an absolute integer and not a float.300530164787%1 === 0
and300530164787.234%1 === 0.234
orvalue%1 === 0
It also throws an error :