How to change bases?
|
04-08-2019, 01:14 AM
Post: #5
|
|||
|
|||
RE: How to change bases?
Is this undocumented? Prime can convert any base-10 integer to any other base, and any number in any base to base 10. The only caveats are that you have to do it in CAS (not Home), you have to type the CONVERT command in lowercase letters, and you have to remember that the non-decimal base numbers are represented as arrays of integers in backwards order.
Examples in CAS: convert(12345,base,6) --> [3,5,0,3,3,1] ... this means that 12345 in base 10 = "133053" in base 6 convert([3,5,0,3,3,1],base,6) --> 12345 ... this means that "133053" in base 6 = 12345 in base 10 If you wish, you may use a list instead of an array here; both seem to work fine. Since there is no upper limit for the base you specify, Prime does not use letters or other characters to stand for digit values above 9. It just gives you their decimal value, like this: convert(1234,base,16) --> [2,13,4] ... this means that 1234 (base 10) = "4D2" in hex, with the "D" being shown as 13. <0|ΙΈ|0> -Joe- |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)