Problem 44789. Big Integer Sqrt

Solution 3664153

Submitted on 15 Nov 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
tic for i = 1 : 150 s = num2str([randi(9),randi([0, 9], 1, i)],-6); t = java.math.BigInteger(s); a = big_integer_sqrt(char(t.pow(2))); assert(isequal(a, char(s))); end toc

Undefined function 'sqrt' for input arguments of type 'int64'. Error in big_integer_sqrt (line 3) y = char(py.long(sqrt(int64(str2num(char(py.long(x))))))) Error in Test1 (line 5) a = big_integer_sqrt(char(t.pow(2)));