HP Forums

Full Version: HHC 2019 will be in Reno, Nevada, Sept 21-22
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Claudio, can you explain how this part of the code works? I'm guessing that RANGE produces a list of numbers from 0 to 9 by 1's. And I think NEWRPL's + operator adds corresponding elements in lists (rather than appending lists). But how does it create a list of 1000 numbers?

Thanks,
Dave

(09-30-2019 04:15 PM)Claudio L. Wrote: [ -> ]
Code:

«
  0 9 1 RANGE      @ Make a case-list of numbers 0-9
 3 ^ DUPDUP + +    @ Sum of the cubes of the digits of ALL numbers from 0 to 999
(09-30-2019 09:54 PM)David Hayden Wrote: [ -> ]Claudio, can you explain how this part of the code works? I'm guessing that RANGE produces a list of numbers from 0 to 9 by 1's. And I think NEWRPL's + operator adds corresponding elements in lists (rather than appending lists). But how does it create a list of 1000 numbers?

Thanks,
Dave

(09-30-2019 04:15 PM)Claudio L. Wrote: [ -> ]
Code:

«
  0 9 1 RANGE      @ Make a case-list of numbers 0-9
 3 ^ DUPDUP + +    @ Sum of the cubes of the digits of ALL numbers from 0 to 999

Yes, sorry, I posted in a rush with no time to explain.
RANGE is similar to the Python Range(), creates a list of integers, giving start, end and step. In newRPL, it creates not a list but a case-list. It's a new type of object, similar to a list but with different overloaded operators, so it behaves different.
I call them case-lists because it's a list of alternative results. When you assign a case list c{ 1 2 3 } to a variable X, it means X may take any of the values in the list. For example the square root of 4 could return c{ 2 -2}, because it could take either value.
When you add 2 case-lists, the result is all possible combinations: c{1 2 } c{ 3 4 } + returns c{ 1+3 2+3 1+4 2+4} since there could be 4 different results.
Back to the code above, RANGE just makes the case-list with 0 to 9. 3 ^ simply cubes each element. DUPDUP + + results in a list with all possible combinations of the sum of the cubes. The resulting list has all 1000 numbers, and the order of those numbers happens to match the order of the numbers 0 to 999. So the index of the list NSUB-1 is also the 3-digit number that gave origin to each element.
Case-lists were added to newRPL to be able to process expressions where a function may have multiple results, or when you want to try several values for a variable on a single EVAL.
So far it's used by ALLROOTS, which returns all roots where XROOT returns only the principal value, but case-lists are really handy.
I ported my program to the 35s. Due to the lack of labels and dearth of indirect addressing registers, it was much harder than I thought. Now I understand why people view the 42s as the pinnacle of RPN models. It looks like the HP32s started the trend of few labels and single-letter variables. Is that right?

Anyway, here is the code. My apologies for the comments not lining up. It runs in 1 minute 22 seconds:
Code:
D001    LBL D    
        9            ; Precompute 03-93
        STO I
        RCL I
D005    3
        y^x
        STO(I)
        DSE I
        GTO D004
D010    CLx
        STO(I)
        -26            ; Store results in Z..W
        STO K
        1.009
D015    STO L        ; X from 1-9
        RCL L
        STO I
        RCL(I)         ; X^3
        STO A        ; S1
D020    RCL I
        IP
        100
        ×
        STO D        ; N1
D025    .009
        STO M
        RCL M
        STO I
        RCL(I)
D030    RCL+ A
        STO B        ; S2
        RCL I
        IP
        10
D035    ×
        RCL+ D
        STO E        ; N2
        .009            ; For Z=0 to 9
        STO J
D040    RCL(J)
        RCL+ B        ; S3
        RCL J
        IP
        RCL+ E        ; N3
D045    X≠Y?             ; S≠N? 
        GTO D052        ; branch
        RCL K        ; If S=N then store
        STO I
        R↓
D050    STO(I)
        ISG K
        9
        +
        x<y?             ; N+9 < S?
D055    GTO D058            ; break out of z loop
        ISJ J            ; Loop for X digit
        GTO D040
        ISG M        ; Loop for Y digit
        GTO D027
D060    ISG L                ; Loop for X digit
        GTO D014
        RCL Z
        RCL X
        RCL Y
D065    RCL W
        RTN
FYI, Richard Nelson just published the HHC 2019 Conference Report. It is available on the HHC 2019 home page, and directly from here: http://hhuc.us/2019/HHC-2019-Conference-Report.pdf
(12-17-2019 12:51 AM)Joe Horn Wrote: [ -> ]FYI, Richard Nelson just published the HHC 2019 Conference Report. It is available on the HHC 2019 home page, and directly from here: http://hhuc.us/2019/HHC-2019-Conference-Report.pdf

Was there ever a report for 2018?
A report for HHC 2018 was never published.
(12-18-2019 02:37 AM)Monte Dalrymple Wrote: [ -> ]Was there ever a report for 2018?

Unfortunately, no. Richard has written summary reports for 7 of the past 20 HHC conferences, namely, the ones shown below with links to their respective reports. The years with no link have no report. Info about them can be found at http://hhuc.us

2019 - 2018 - 2017 - 2016 - 2015
2014 - 2013 - 2012 - 2011 - 2010
2009 - 2008 - 2007 - 2006 - 2005
2004 - 2003 - 2002 - 2001 - 2000
(12-18-2019 04:20 AM)Joe Horn Wrote: [ -> ]
(12-18-2019 02:37 AM)Monte Dalrymple Wrote: [ -> ]Was there ever a report for 2018?

Unfortunately, no. Richard has written summary reports for 7 of the past 20 HHC conferences, namely, the ones shown below with links to their respective reports. The years with no link have no report. Info about them can be found at http://hhuc.us

2019 - 2018 - 2017 - 2016 - 2015
2014 - 2013 - 2012 - 2011 - 2010
2009 - 2008 - 2007 - 2006 - 2005
2004 - 2003 - 2002 - 2001 - 2000

Hi Joe,
On the PPC Archive DVD in the "CD4" section (containing all the conference materials), there are Richard Nelson-penned conference reports (in addition to the ones you listed) for 2002, 2004, 2007, 2008, 2010 and 2016. For the recent conference attendees, the archive DVD material was provided on the conference USB drive.

Thanks,
Jake
(12-18-2019 05:52 PM)Jake Schwartz Wrote: [ -> ]Hi Joe,
On the PPC Archive DVD in the "CD4" section (containing all the conference materials), there are Richard Nelson-penned conference reports (in addition to the ones you listed) for 2002, 2004, 2007, 2008, 2010 and 2016. For the recent conference attendees, the archive DVD material was provided on the conference USB drive.

Awesome! Thanks for the heads up. I'll add those reports to the respective HHC home pages ASAP.
Pages: 1 2 3 4
Reference URL's