How to write vector form of very large number?
조회 수: 2 (최근 30일)
이전 댓글 표시
I have to deal with very large numbers like 99^99.
I want these numbers in the vector form. For example, for 5^5=3125 , I should be able to write this in the form {3, 1, 2, 5}
Though the method with sprintf works for some smaller number but num2str-'0' gives negative numbers ?
댓글 수: 0
답변 (2개)
David Hill
2020년 1월 10일
You could always use java BigInteger if you don't have symbolic toolbox.
import java.math.*
x=BigInteger(99);
x=x.pow(99);
x=char(x)-'0';
댓글 수: 0
Walter Roberson
2020년 1월 10일
John D'Errico has a Variable Precision Integer contribution in the file exchange.
Or you use symbolic toolbox if you have that.
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear Algebra에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!