In MATLAB, the vpi
(Variable Precision Integer) function can be used to work with large integers. To create an array with each digit of the number 2^1000, we can first calculate 2^1000 as a vpi
object, and then convert it to a string. Finally, we can convert the string to a character array and then to a numerical array.
Here is the code:
main.m176 chars9 lines
The arr
variable will contain an array with each digit of 2^1000.
gistlibby LogSnag