HP Forums
(11C) Bernoulli Numbers - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (11C) Bernoulli Numbers (/thread-13359.html)



(11C) Bernoulli Numbers - Gamo - 07-28-2019 06:05 AM

This program was adapted from [HP-12C Bernoulli Numbers] at

https://www.hpmuseum.org/forum/thread-13348.html

With 11C and 15C the result answer is more accurate because of the Pi function.

Procedure:

Same as on 12C except

Looking for B(n) execute at [LBL] B

Need answer in fraction execute at [LBL] D
-----------------------------------------------
Program:
For faster computation recommend HP-15C LE or Emulator
Code:

LBL B   // B(n) for n  ÷ 2
2 x 
STO 2
1
STO 0
STO 1  // Done Initialize 
-----------
LBL 0
RCL 0
2 x 1 +
RCL 2
CHS
Y^X  
RCL 1
+
RCL 1
X=Y
GTO 1
X<>Y
STO 1
1
STO+0
GTO 0
----------
LBL 1
RCL 2
x!
2 x
RCL 1
x 2
RCL 2
Y^X
1 -
RCL 2
Pi
X<>Y
Y^X
x ÷
RTN  // If B(n) with n divisible by 4 answer is "Negative"
----------
LBL D  // For Decimal to Fraction 
STO 0
STO 1
0
ENTER
ENTER
1
R^  // Roll Up
---------
LBL 5
INT
R^  
x +
STO 2
GSB 7
X<>Y
÷
RND
RCL 0
RND
X=Y
GTO 6
+
CLx
RCL 2
ENTER
ENTER
R^
RCL 1
FRAC
1/x
STO 1
GTO 5
---------
LBL 6
RCL 2
---------
LBL 7
ENTER
ENTER
RCL 0
x
. 5  // decimal and five
+
INT
RTN

Gamo