## Sunday, August 9, 2020

### HP 12C: Last X: Sums and Products

HP 12C:   Last X:   Sums and Products

Introduction

It is possible to use the LST X feature on the HP 12C calculators assist us in quickly calculate sums or products  of a terms, especially when the list of terms are in a series.

For today's blog, we are starting with a base amount, a, and then adding 1 to each term.   You can use a similar algorithm for a sequence where each term is doubled, tripled, 1 is subtracted from the previous term, and so on.  The key is to complete the adjustment, use storage arithmetic, and then use LST X.

Accessing LST X:

HP 12C (Classic):  [ g ] [ ENTER ]

HP 12C Platinum:  [ g ] [ + ]

These algorithms can be used in program.

Sum:  a + (a+1) + (a+2)  + (a+3) + ....

Let n represent the storage register to be used.  On the HP 12C, only storage registers R0 through R4 (classic HP 12C).

Algorithm:

STO n

Loop:
LST X
1     [ or 2, x  to double each term,  1, - to subtract 1, etc.]
+
STO+ n    [stores what is in the X display to the Last X register]

Finish:
RCL n

Example:  7 + 8 + 9 +10 = 34.   Use register 0 to store the sum.

7
STO 0

LST X
1
+
STO+ 0

LST X
1
+
STO+ 0

LST X
1
+
STO+ 0

RCL 0

Sum:  1/a + 1/(a+1) + 1/(a+2) + 1/(a+3) + ....

Algorithm:

1/x
STO n

Loop:
LST X
1
+
1/x
STO+ n

Finish:
RCL n

Example:  1/7 + 1/8 + 1/9 + 1/10 ≈ 0.47897

7
1/x
STO 0

LST X
1
+
1/x
STO+ 0

LST X
1
+
1/x
STO+ 0

LST X
1
+
1/x
STO+ 0

RCL 0

Sum:  √a + √(a+1) + √(a+2) + √(a+3) + ...

Algorithm:

STO n

Loop:
LST X
1
+

STO+ n

Finish:
RCL n

Try the algorithm on this example:  √7 + √8 + √9 + √10 ≈ 11.63646

Sum:  a^2 + (a+1)^2 + (a+2)^2 + (a+3)^2 + ...

Hint:  Use ENTER, x instead of 2, y^x

Algorithm:

ENTER
*
STO n

Loop:
LST X
1
+
ENTER
*
STO+ n

Finish:
RCL n

Try the algorithm on this example:  7^2 + 8^2 + 9^2 + 10^2 = 294

Let's move on to products.

Product:  a * (a+1) * (a+2) * (a+3) * ....

STO n

Loop:
LST X
1
+
STOx n

Finish:
RCL n

Example:  7 * 8 * 9 * 10 = 5040.   Use register 0 to store the product.

7
STO 0

LST X
1
+
STOx 0

LST X
1
+
STOx 0

LST X
1
+
STOx 0

RCL 0

Product:  1/a * 1/(a+1) * 1/(a+2) * 1/(a+3) * ....

1/x
STO n

Loop:
LST X
1
+
1/x
STOx n

Finish:
RCL n

Try the algorithm on this example 1/7 * 1/8 * 1/9 * 1/10 ≈ 0.0020

Product:  √a * √(a+1) * √(a+2) * √(a+3) * .......

STO n

Loop:
LST X
1
+

STOx n

Finish:
RCL n

Try the algorithm on this example √7 * √8 * √9 * √10 ≈ 70.99296