Post Reply 
How to change bases?
11-30-2019, 04:48 AM
Post: #14
RE: How to change bases?
(11-29-2019 06:34 PM)Joe Horn Wrote:  I just stumbled upon a way to force Prime to return base-converted numbers in correct digit order (not backwards digit order as seen above in this thread).

Just put "base" in quotes. That's all it takes! And it even works in Home and in ordinary (non-CAS) programs!

Example in Home:
CONVERT(1234567, "base", 12) --> [ 4 11 6 5 4 7 ]
... this means that 1234567 in decimal equals 4B6547 in base 12.

The reverse can also be done like this:
CONVERT( [4,11,6,5,4,7], "base", 12) --> 1234567
... but I prefer this simpler method:
POLYEVAL( [4,11,6,5,4,7], 12) --> 1234567

Note: This also works in CAS and in CAS programs, but then you have to be careful to type CONVERT in uppercase letters. The "base" option is always case insensitive, and must be in quote marks to return the digits in correct order. Due to a bug, negative inputs for the first argument can crash, so for now only use positive inputs. Negative and non-integer bases return interesting results.

Great info, Joe! Is that documented anywhere but here?

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
How to change bases? - kevin3g - 04-07-2019, 02:45 PM
RE: How to change bases? - rprosperi - 04-07-2019, 03:31 PM
RE: How to change bases? - Aries - 04-07-2019, 03:50 PM
RE: How to change bases? - Don Shepherd - 04-08-2019, 12:44 AM
RE: How to change bases? - toml_12953 - 04-10-2019, 12:46 AM
RE: How to change bases? - Albert Chan - 04-27-2019, 06:52 PM
RE: How to change bases? - Joe Horn - 04-08-2019, 01:14 AM
RE: How to change bases? - rprosperi - 04-08-2019, 01:36 AM
RE: How to change bases? - Joe Horn - 04-08-2019, 02:12 AM
RE: How to change bases? - John Keith - 04-08-2019, 01:11 PM
RE: How to change bases? - rprosperi - 04-08-2019, 07:39 PM
RE: How to change bases? - parisse - 04-08-2019, 09:29 AM
RE: How to change bases? - Joe Horn - 11-29-2019, 06:34 PM
RE: How to change bases? - toml_12953 - 11-30-2019 04:48 AM
RE: How to change bases? - Joe Horn - 11-30-2019, 01:01 PM
RE: How to change bases? - rprosperi - 11-30-2019, 02:41 PM
RE: How to change bases? - toml_12953 - 11-30-2019, 03:16 PM
RE: How to change bases? - Steve Simpkin - 11-30-2019, 06:26 PM
RE: How to change bases? - Joe Horn - 11-30-2019, 07:21 PM
RE: How to change bases? - toml_12953 - 11-30-2019, 08:34 PM
RE: How to change bases? - Didier Lachieze - 12-01-2019, 08:43 AM
RE: How to change bases? - rprosperi - 12-01-2019, 02:42 PM
RE: How to change bases? - Tim Wessman - 12-02-2019, 06:16 AM
RE: How to change bases? - YEDERF - 12-03-2019, 02:05 AM



User(s) browsing this thread: 5 Guest(s)