(12C) Sums of Σx, Σx^2, Σx^3
01-07-2017, 05:28 PM (This post was last modified: 06-15-2017 01:14 PM by Gene.)
Post: #1
 Eddie W. Shore Senior Member Posts: 733 Joined: Dec 2013
(12C) Sums of Σx, Σx^2, Σx^3
HP 12C: Sums of Σx, Σx^2, Σx^3

This program takes two arguments:

Y: x
X: n (where n=1, n=2, n=3)

If n = 1, the sum Σ x from 1 to n is calculated
If n = 2, the sum Σ x^2 from 1 to n is calculated
If n = 3, the sum Σ x^3 from 1 to n is calculated

If n is not 1, 2, or 3, an error occurs.

Program:

Keep in mind: this is done on the HP 12C (regular). For the HP 12C Platinum, the code for Last X is 43, 40 ([ g ] [ + ]) and the step numbers are three digits (000 instead of 00).

STEP; KEY; CODE NUMBER
01; X<>Y; 34
02; STO 1; 44, 1
03; X<>Y; 34
04; STO 0; 44, 0
05; 1; 1
06; -; 30
07; X=0; 43,35
08; GTO 21; 44, 33, 21
09; RCL 0; 45, 0
10; 2; 2
11; -; 30
12; X=0; 43, 35
13; GTO 29; 44, 33, 29
14; RCL 0; 45, 0
15; 3; 3
16; -; 30
17; X=0; 43, 35
18; GTO 46; 43, 33, 46
19; 0; 0
20; ÷; 10
21; RCL 1; 45, 1
22; ENTER; 36
23; *; 20
24; LST X; 43, 36
25; +; 40
26; 2; 2
27; ÷; 10
28; GTO 00; 43, 33, 00
29; RCL 1; 45, 1
30; ENTER; 36
31; *; 20
32; LST X; 43, 36
33; X<>Y; 34
34; 3; 3
35; *; 20
36; +; 40
37; RCL 1; 45, 1
38; 3; 3
39; Y^X; 21
40; 2; 2
41; *; 20
42; +; 40
43; 6; 6
44; ÷; 10
45; GTO 00; 43, 33, 00
46; RCL 1; 45, 1
47; ENTER; 36
48; ENTER; 36
49; 1; 1
50; +; 40
51; *; 20
52; ENTER; 36
53; *; 20
54; 4; 4
55; ÷; 10
56; GTO 00; 43, 33, 00

Example: n = 5
Y: 5, X: 1. Result: 15
Y: 5, X: 2. Result: 55
Y: 5, X: 3. Result 225
 « Next Oldest | Next Newest »

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