2023 in Base 37
01-07-2023, 11:17 AM (This post was last modified: 01-07-2023 11:35 AM by C.Ret.)
Post: #10
 C.Ret Member Posts: 249 Joined: Dec 2013
RE: 2023 in Base 37 for the 28's users
Hello every one,

(01-06-2023 08:25 PM)John Keith Wrote:  In the strings:
The numbers 0..9 map to themselves
The numbers 10..35 map to A..Z
The numbers 36..61 map to a..z[/code]

Thanks for the clarification, I was wondering what to put in the conversion table after the 36th symbol, aka the Big Z character.

For the one who only have $$102474081_{37}$$ (and only one):

First store the character conversion table as a string into the 'CC' variable:

"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" 'CC' STO

Note how easy is this entry to key-in since all these characters are ordered on the two keyboards and didn't need any shift-key, except for one press on the lc key to switch into lower-case entry mode.

Second enter one or both of the conversion code depending in which direction you need to convert. Both code take two arguments from the stack and return one result

« → b « "" OVER LOG b LOG / FLOOR 0 FOR k
SWAP b k ^ MOD LAST / IP ROT CC ROT 1 + DUP SUB +
-1 STEP
SWAP DROP » »                                   ‘→BSTR’ STO

n b →BSTR convert decimal-based integer n into b-base string Str.
For example, 2023 37 →BSTR display "1HP"

« → s b « 0
1 s SIZE FOR k
b * CC s k k SUB POS 1 -
IF DUP 0 < OVER b ≥ OR
THEN "’" s k k SUB + "’ Bad Char" + KILL
ELSE + END
NEXT » »                                     ‘BSTR→’ STO

Str b BSTR→ convert b-based character string Str into real integer n (or display error message when an illegal character is found anywhere in the string Str).
For example, "HP50g" 62 BSTR→ return 257175174.

Have had a lot of fun thanks !

Since it is the season, I wish you all $$77490_{50}$$ $$81179749_{51}$$ $$80140568_{52}$$ $$2G7_{28}$$ !
 « Next Oldest | Next Newest »

 Messages In This Thread 2023 in Base 37 - Joe Horn - 01-06-2023, 12:21 PM RE: 2023 in Base 37 - pier4r - 01-06-2023, 12:58 PM RE: 2023 in Base 37 - John Keith - 01-06-2023, 06:34 PM RE: 2023 in Base 37 - Maximilian Hohmann - 01-06-2023, 01:05 PM RE: 2023 in Base 37 - toml_12953 - 01-06-2023, 08:07 PM RE: 2023 in Base 37 - pier4r - 01-06-2023, 07:58 PM RE: 2023 in Base 37 - John Keith - 01-06-2023, 08:25 PM RE: 2023 in Base 37 for the 28's users - C.Ret - 01-07-2023 11:17 AM RE: 2023 in Base 37 - pier4r - 01-07-2023, 11:39 AM RE: 2023 in Base 37 - Gerald H - 01-07-2023, 04:06 AM RE: 2023 in Base 37 - brouhaha - 01-07-2023, 06:23 AM RE: 2023 in Base 37 - mfleming - 01-07-2023, 09:59 PM RE: 2023 in Base 37 - John Keith - 01-20-2023, 07:41 PM

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