Originally posted on Abandon MATLAB:
The ninth Mersenne prime is 261 – 1 = 2305843009213693951. Try to cause MATLAB to represent this value in a simple variable, then display it.
For example here is a Python session that passes by direct calculation:
>>> x = pow(2,61) - 1 >>> x 2305843009213693951L
That obtained the value by calculation, but no mathematical sophistication should be required to stuff a number in a variable. In fact, you may want to see if there’s any way you can simply type the number in to MATLAB and have it represented, as you see here in Python:
>>> x = 2305843009213693951 >>> x 2305843009213693951L
MATLAB has built-in uint64 and int64 data types that are, in principle, able to hold this value, so you should have no problem either way. Heh.
(A contrived example, you suggest? I have experiments running in MATLAB that communicate with a simple data acquisition device, one…
View original 14 more words