Post Reply 
33s Evaluates Some Large Powers 50g Refuses
08-18-2022, 05:17 AM
Post: #1
33s Evaluates Some Large Powers 50g Refuses
On 33s

-1^999999999999

is evaluated correctly while 50 g returns

"Integer too large"

error.
Find all posts by this user
Quote this message in a reply
08-18-2022, 06:18 AM
Post: #2
RE: 33s Evaluates Some Large Powers 50g Refuses
Try adding a decimal point (or comma, depending on your radix separator) to the -1. This tells the HP-50g you want a numerical answer instead of a symbolic answer which uses the CAS engine.

For example:
-1.^999999999999
Returns -1.
Visit this user's website Find all posts by this user
Quote this message in a reply
08-18-2022, 08:43 AM
Post: #3
RE: 33s Evaluates Some Large Powers 50g Refuses
Thank you, Steve, that solves it for smaller numbers.

I came upon this when writing

https://www.hpmuseum.org/forum/thread-18683.html

The programme is compact:

Code:
1.    LBL B
2.    STO N
3.    CLx
4.    N+(-1)^N+2*(-1)^IDIV(N:2)
5.    RTN

K: LN = 40        CK = 25E5

Trying this on the 50g I was disappointed at the error report for larger powers of 1 & -1, ie greater than 999999999999. The programme below works for larger numbers, nevertheless it's a disappointment the 50g gives up at some point in powers of the unit.

Code:
Size: 96.

CkSum: # 7D33h

::
  CK1&Dispatch
  # FF
  ::
    FPTR2 ^DupZIsEven?
    ITE
    ZINT 1
    ZINT -1
    OVER
    ZINT 2
    FPTR2 ^ZQUOText
    FPTR2 ^DupZIsEven?
    SWAPDROP
    ITE
    ZINT 1
    ZINT -1
    DUP
    FPTR2 ^RADDext
    FPTR2 ^RADDext
    FPTR2 ^RADDext
  ;
;
Find all posts by this user
Quote this message in a reply
08-18-2022, 01:57 PM (This post was last modified: 08-18-2022 02:04 PM by John Keith.)
Post: #4
RE: 33s Evaluates Some Large Powers 50g Refuses
Though it doesn't address the issue of integer powers, we can get the result for any number < 2^63 using binary numbers with #3 XOR. this works on any RPL calculator but requires entering the number with a leading #. The 3 can be replaced with any other integer to return values for similar sequences since Nim addition is just XOR.

Going even farther afield, we can make lists of A004444 and similar sequences very rapidly using ListExt commands on the 50g by taking advantage of the structure of the sequence (groups of 4 consecutive numbers reversed). Given a number n on the stack, the following program returns 4n terms of the sequence. If the 4's in the program are replaced with 2's, the program will return 2n terms of A004442.

Code:

\<< 0 SWAP 4 * 1 - LSEQR @ List of numbers 0 to 4n-1
    4 LSDIV              @ Break up into sublists of 4                 
    :: REV LMAP          @ Reverse each sublist
    LXIL                 @ Flatten list
\>>

With the number 250 on the stack, the program returns the first 1000 terms in 1.5 seconds on my 50g.
Find all posts by this user
Quote this message in a reply
08-19-2022, 04:09 AM
Post: #5
RE: 33s Evaluates Some Large Powers 50g Refuses
Also the HP35S gives the correct answer.



Put a calculator into your life!
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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