Post Reply 
HP 38G: Better than Prime for some Sequences using the built in Sequence App
03-08-2015, 09:50 AM (This post was last modified: 03-08-2015 10:06 AM by Tugdual.)
Post: #39
RE: HP 38G: Better than Prime for some Sequences using the built in Sequence App
Using a buffer list I could finally achieve decent times on the 48G. I have 4 objects.
1. PU1 creates the list
2. U1 "optimized" recursion loop
3. STPW a simple stop watch
4. TU1 is the variable that contains the list of U(n) values.

Code:
PU1
« → N
  « 'TU1' PURGE
    « 0
    » 'X' 1 N 1 SEQ TU1 STO
  »
»

Code:
U1
« → N
  « TU1 N GET DUP 0 ==
    « DROP N 3 <
      « 1
      »
      « N 1 - U1 DUP U1 SWAP N - NEG U1 +
      » IFTE
    » IFT DUP 'TU1' N 3 ROLL PUT
  »
»

Code:
STPW
« TICKS → T 
  « EVAL TICKS T - 8192 / B→R
  »
»

Usage:
99 ENTER
Call PU1 from VAR menu

99 ENTER
'U1' ENTER
Call STPW from VAR menu

2: 56
1: 75 (1'15'')

Decent results. I can't help thinking that the 38G does something similar to avoid 2 millions recursions... The previous pure recursion version I posted was not finished after +30mn.
Was cool to play with RPL. What a strange language :-)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP 38G: Better than Prime for some Sequences using the built in Sequence App - Tugdual - 03-08-2015 09:50 AM



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