HP Forums
2023 in Base 37 - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not remotely HP Calculators (/forum-9.html)
+--- Thread: 2023 in Base 37 (/thread-19384.html)



2023 in Base 37 - Joe Horn - 01-06-2023 12:21 PM

New Year's trivia: 2023 in base 10 equals 1HP in base 37. Posted in the "Not Remotely" forum because no member here has only 1HP. Big Grin


RE: 2023 in Base 37 - pier4r - 01-06-2023 12:58 PM

Nice bit of trivia!

An extension would be: find the decimal numbers (and the transforming base) in which one can write HP35, HP71, HP50G and so on. I believe the base 37 would suffice in most cases.


RE: 2023 in Base 37 - Maximilian Hohmann - 01-06-2023 01:05 PM

Hello!

(01-06-2023 12:21 PM)Joe Horn Wrote:  Posted in the "Not Remotely" forum because no member here has only 1HP.

Well, until not so long ago I had my own horse, so really 1HP ;-) (Now I am sharing one so I am down to 1/2HP, not sure how to translate that to Base 37)...

Regards
Max


RE: 2023 in Base 37 - John Keith - 01-06-2023 06:34 PM

(01-06-2023 12:58 PM)pier4r Wrote:  Nice bit of trivia!

An extension would be: find the decimal numbers (and the transforming base) in which one can write HP35, HP71, HP50G and so on. I Believe the base 37 would suffice in most cases.

Actually base 36 is sufficient to encode the digits 0..9 and the letters A..Z, base 37 just happened to work for Joe's amusing example. Web sites often use base 64 to encode data in URL's in the form of alphanumeric strings.


RE: 2023 in Base 37 - pier4r - 01-06-2023 07:58 PM

True! As usual I left my brain off instead of thinking for a moment that 10+26 would cover all the needed letters.


RE: 2023 in Base 37 - toml_12953 - 01-06-2023 08:07 PM

(01-06-2023 01:05 PM)Maximilian Hohmann Wrote:  Hello!

(01-06-2023 12:21 PM)Joe Horn Wrote:  Posted in the "Not Remotely" forum because no member here has only 1HP.

Well, until not so long ago I had my own horse, so really 1HP ;-) (Now I am sharing one so I am down to 1/2HP, not sure how to translate that to Base 37)...

Regards
Max

But even a real horse has up to about 14-15 HP, so we owners are allowed to have more!

How much horsepower does a horse have?


RE: 2023 in Base 37 - John Keith - 01-06-2023 08:25 PM

Just for fun, here are two programs for converting integers to and from strings representing the integers in any base up to base 62. The programs are for the HP49/50 with the ListExt Library.
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

The first program I→STR take an integer n on level 2 and an integer b on level 1 and returns a string representing n in base b.

Code:

\<< I\->BL NL\->S
    { 36. 61. 61. } CHR+
    { 10. 35. 55. } CHR+
    { 0. 9. 48. } CHR+
\>>

The next program STR→I does the inverse, taking a string on level 2 and b on level 1.

Code:

\<< SWAP
    { 48. 57. -48. } CHR+
    { 65. 90. -55. } CHR+
    { 97. 122. -61. } CHR+
    S\->NL SWAP BL\->I
\>>

For example, the input

257175174
62
I→STR

returns "HP50g"


RE: 2023 in Base 37 - Gerald H - 01-07-2023 04:06 AM

This programme

https://www.hpmuseum.org/forum/thread-4008.html?highlight=XdYB

for input

2023
2
37

returns

:37: { 27 12 "." "°" 18 }


RE: 2023 in Base 37 - brouhaha - 01-07-2023 06:23 AM

(01-06-2023 12:21 PM)Joe Horn Wrote:  New Year's trivia: 2023 in base 10 equals 1HP in base 37. Posted in the "Not Remotely" forum because no member here has only 1HP. Big Grin

Someone recently pointed out to me that 2023 isn't prime. I already knew that, but I had hoped that it would be choice, or at least select.

Looking forward to 2027 and 2029.


RE: 2023 in Base 37 for the 28's users - C.Ret - 01-07-2023 11:17 AM

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}\) !


RE: 2023 in Base 37 - pier4r - 01-07-2023 11:39 AM

(01-07-2023 11:17 AM)C.Ret Wrote:  Since it is the season, I wish you all \(77490_{50}\) \(81179749_{51}\) \( 80140568_{52}\) \(2G7_{28}\) !

Yes that is a better variant of what I had in mind, finding the equivalent value for words. Also this reminds me that mathjax is active here, I totally forgot.


RE: 2023 in Base 37 - mfleming - 01-07-2023 09:59 PM

Another approach, using Albert's base conversion function and indexing, we could have

Code:

      base←⊥⍣¯1
      digits←'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'

      37 base 2023
1 17 25
      digits[1+37 base 2023]
1HP

Extending the range of digits and encapsulating the operation as a function gives

Code:

      +digits←digits,'abcdefghijklmnopqrstuvwxyz'
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
      digits[1+62 base 257175174]
HP50g

      tochar←{digits[1+⍺ base ⍵]}
      37 tochar 2023
1HP
      62 tochar 257175174
HP50g

Now just need the reverse conversion to see a season's greeting!

~Mark

[edit] Oops! Function base corrected per Albert Smile [/edit]


RE: 2023 in Base 37 - John Keith - 01-20-2023 07:41 PM

Inspired by a new sequence A359840 I noticed that while 2023 is not prime in base 10, it is prime in many (perhaps infinitely many?) other bases. A quick check counted 819 bases < 10,000 in which 2023 is prime.