This challenge is an application of java.math that allows unlimited precision calculations. The primary reference sites are Java Math, Java BigDecimal, and Java BigInteger.
The usage of BigDecimal function multiply will be essential.
Java Math tutorial: (Simplified summary that is believed correct)
vd-decimal value, vstr-string, vi-integer value xBD=java.math.BigDecimal(vd); % valid vd,vstr,vi creates xBD a BigDecimal variable import java.math.*; % simplifies statements xBD=BigDecimal(vstr);
xmultiplyzBD=xBD.multiply(BigDecimal(z)); % multiply input requires BD type
To convert java to string of unlimited length can be achieved via java toString or Matlab char
xstr=toString(xBD) or xstr=char(xBD)
Input: N [1< N < 1000]
Output: Y (char variable of Y=N! or a BigDecimal variable)
Related Challenges:
2. nchoosek_large (full precision) 2. Next Prime 3. factor_large 4. Factorial
Solution Stats
Solution Comments
Show commentsProblem Recent Solvers49
Suggested Problems
-
Remove the polynomials that have positive real elements of their roots.
1743 Solvers
-
Project Euler: Problem 1, Multiples of 3 and 5
3740 Solvers
-
1558 Solvers
-
Square Digits Number Chain Terminal Value (Inspired by Project Euler Problem 92)
267 Solvers
-
Convert given decimal number to binary number.
2390 Solvers
More from this Author306
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!