Admittedly, I know very little about Java but I'm suprised this work since I can't find a constructor that takes a double. Only strings, byte patterns or random number generators. Care to explain?
There are a constructors for int and double: http://docs.oracle.com/javase/1.5.0/docs/api/java/math/BigDecimal.html#BigDecimal(int)
http://docs.oracle.com/javase/1.5.0/docs/api/java/math/BigDecimal.html#BigDecimal(double)
Oh yes, I missed that you were using BigDecimal instead of BigInteger.
i have a 25 sized solution but it doesnt accept since i used symbolic toolbox :)
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
base = 3; expo = 8; n = 2;
y_correct = 61;
assert(isequal(lastndigit(base,expo,n),y_correct))
|
2 | Pass |
%%
base = 7; expo = 12; n = 5;
y_correct = 87201;
assert(isequal(lastndigit(base,expo,n),y_correct))
|
3 | Pass |
%%
base = 25; expo = 71; n = 15;
y_correct = 896881103515625;
assert(isequal(lastndigit(base,expo,n),y_correct))
|
4 | Pass |
%%
base = 768; expo = 1579; n = 22;
y_correct = 3750595090000885317632;
assert(isequal(lastndigit(base,expo,n),y_correct))
|
397 Solvers
1594 Solvers
Who is the smartest MATLAB programmer?
469 Solvers
07 - Common functions and indexing 2
255 Solvers
Add a row of zeros on top of a matrix
145 Solvers