# HP Forums

Full Version: HP-80 Function Question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I recently obtained a HP-80. While experimenting with various functions, I noticed that consecutive presses on (Yellow Shift)+(dot) changes the X value and the stack. Seems like doing some calculation, however couldn't find any information in the manual or elsewhere what type of function it is performing. Any idea? Thanks.

The result is the same as SIGMA+, and there are nothing in the user's manual, if I remember well.

You can make some test to verify the results in the stack:

Reg X SUM of data;

Reg Y Num of data;

Reg Z SUM of X^2;

Reg T the same of Y reg.

HTH

Ignazio

Edited: 10 Feb 2012, 3:02 p.m.

I was suspecting that however, after total clear:
Pressing shift+dot generates:
0
1
2
3
5
11
26
66
227

Pressing sigma+ generates:
0
1
0
-1
-3
-5
-8
-20
-57
-158

That's what shift-dot does on the HP-80, whatever it is, starting from a clear stack:

```T: 0 0 0 1 5 14 39 160 836 5192
Z: 0 0 0 1 5 14 39 160 836 5192
Y: 0 1 1 1 2  6 15  40 161  837
X: 0 0 1 2 3  5 11  26  66  227
```

Here is a BASIC program that produces the contents of stack registers X and Y:

``` 5 CLS
10 A = 0: B = 0: X = 0: B = 1
20 PRINT X;
25 IF X > 100000 THEN END
30 C = A + B
40 D = B + X * X
50 X = A: A = C
60 Y = B: B = D
70 GOTO 20
0  0  1  2  3  5  11  26  66  227  1064  6257  62979  1251797
```

An interesting function. I wonder if HP was thinking about another financial or statistical function which later they decided not to include thus never made it to the keyboard. I am still trying to figure out what this calculation could be used for, expecially given the numbers displayed as an integer.

Interestingly most of the first few terms are prime numbers:

`1  2  3  5  11  26  66  227  1064  6257  62979  1251797`

The next five terms are composites, however:

```#include <iostream.h>
int main()
{
unsigned __int64 a = 0, b = 1, c, d, x=0, y=0;
a = 0; b = 1; x = 0; y = 0;
for (char i = 1; i <=19; i++)
{
cout << x <<" ";
c = a + b;
d = b + x*x;
x = a;
a = c;
y = b;
b = d;
}
printf("\n\n");
system("pause");
return 0;
}
0 0 1 2 3 5 11 26 66 227 1064 6257 62979 1251797 41590664 4048283972 1575050706489 1732929385089902 16392067401671570099```

RPL in exact mode on the HP 50g will handle those large numbers more easily than C++ though.

-------------

Update:

Yes, better on the HP 50g. No more primes, however. At least up to the 30th term:

```\<< 0 1 0 { } 5 ROLL 1 SWAP
START
OVER + 4 ROLLD SQ OVER + UNROT OVER + UNROT 4 ROLL
NEXT
NIP NIP NIP
\>>
{ 0 0 1 2 3 5 11 26 66 227 1064 6257 62979 1251797 41590664 4048283972 1575050706489
1732929385089902 16392067401671570099 2480817510413371984757417
3003049215326694619490920314339 268699879707039689291938317405726741062
6154455520511000772441212952982808207904869679674
9018304589686585177361346575276066985332356116811106581625207
72199625354577617458397144725821313039714237584299630207413759135099490458584
37877322753948333449755694908105760409757253633480079193708681863162233695095397107688419768038237
81329817672362127432945896422480997301874361053470122520313246583652465523649965949269151256069425402568208827505463410739
52127859013413671535047407030236395396849222294009161464949665161373119998521755364631031658322711552753670697410492320867402812466645759
90995845778068297
14346915790067721633176240664001666629165029005346590080187806856469612582037080298125024141950588218469346345125388922632222175608248895
18185403399728040557501172362103337453970311201525586794024
66145392426196670157751694600396451696020482379488309297589369490227493838452111265830722847572958345973667892914792187598144060583637941
60798522338995129532050772296242939524666311575933016041026411697274553914980751285069710677309108416045872 }
```

Edited: 12 Feb 2012, 4:43 p.m.

Yet another implementation using Python:

```def diff(xs):
y = xs.pop(0)
ys = []
for x in xs:
ys.append(x - y)
y = x
return ys
x, y, z, t = 0, 0, 0, 0
xs = []
for i in range(10):
x, y, z, t = x + y, z + 1, t + x**2, t + x**2
xs.append(x)
print xs
dxs = diff(xs)
print dxs
d2xs = diff(dxs)
print d2xs
```

I calculated the difference between sequent elements:

```[0, 1, 2, 3, 5, 11, 26, 66, 227, 1064]
[1, 1, 1, 2, 6, 15, 40, 161, 837]
[0, 0, 1, 4, 9, 25, 121, 676]
```

This shows that the 2nd difference is the same as the initial sequence squared and shifted.

Or as a recursive formula:
xn+3 = 2 xn+2 - xn+1 + xn2
together with the initial values: x0=0, x1=1, x2=2.

This leads to the simple program:

```x = [0, 1, 2]
for n in range(10):
x.append(2*x[n+2] - x[n+1] + x[n]**2)
print x
```

... which produces the same result:

```[0, 1, 2, 3, 5, 11, 26, 66, 227, 1064, 6257, 62979, 1251797]
```

I've tried in vain to use
WolframAlpha to find a closed form. So I'm afraid there isn't.

Cheers

Thomas

Edited: 13 Feb 2012, 7:06 p.m.

This is my understanding what both operations sigma+ and shift dot do:

```T: T + X^2
Z: T + X^2
Y: Z + 1
X: Y + X
```

However sigma+ seems to change its mind if you don't enter a number and starts to calculate the following instead:

```T: T - X^2
Z: T - X^2
Y: Z - 1
X: Y + X
```

I filled the stack with 1:

sigma+:

```T: 1    2   -2  -18  -43
Z: 1    2   -2  -18  -43
Y: 1    2    1   -3  -19
X: 1    2    4    5    2
```

shift dot:

```T: 1    2    6   22   71
Z: 1    2    6   22   71
Y: 1    2    3    7   23
X: 1    2    4    7   14
```

I can't help but I think you just found a bug. Try the following:

```shift CLEAR
7
STO
sigma+
RCL
sigma+
mean
```

You'll get blinking 9.999999999 99 instead of 7. But you get the correct result when using shift dot instead.

Kind regards

Thomas

Very nice!

Quote:
I've tried in vain to use
WolframAlpha to find a closed form. So I'm afraid there isn't.

It's not in OEIS either.

Regards,

Gerson.

Dear Thomas and Gerson,thank you very much for your responses and detailed analysis. I will use your directions and further experiment with this function. I have been away from my HP-80 last couple days. I also noticed that the sequence you enter the numbers (PV first vs n first) for PMT calculation gives different results. This may be due to limited number of registers HP-80 has and trying to utilize the stack as much as possible in order to solve the equation. I have feeling that shift dot is executing some sort of a subroutine which is being used as part of this solver, although it does seems like a bug since under the right conditions works better than the sigma+ function. Your responses have been very helpful, I have much more to think about now. Sincerely.

Quote:
It's not in OEIS either.

You may ask them to add it. I wonder if they'll accept it.

Since after the first step of the recursion t' = z' we can just forget about t:

```
z' = z + x2
y' = z + 1
x' = x + y

x''' = x'' + y''
y''  = z' + 1 = z + x2 + 1
x''  = x' + y' => x'' - x' = y' = z + 1
x''' = x'' + x'' - x' + x2
= 2 x'' - x' + x2
```

Just in case somebody might not believe that two sequences are equal when they agree on the first few elements.

Cheers

Thomas

Edited: 14 Feb 2012, 3:13 a.m.