Post Reply 
Pi Approximation Day
07-23-2022, 06:46 PM
Post: #13
RE: Pi Approximation Day
(07-23-2022 11:59 AM)Gerson W. Barbosa Wrote:  Not as fun, but we can still rewrite Valentin’s intentionally slightly obfuscated program

Without recall-arithmetic it uses even fewer bytes:
Code:
00 { 27-Byte Prgm }
01▸LBL "?"
02 0
03▸LBL 00
04 RCL ST Y
05 ENTER
06 X↑2
07 +
08 ENTER
09 X↑2
10 ×
11 1/X
12 -
13 DSE ST Y
14 GTO 00
15 10
16 +
17 SQRT
18 END

Using a register we can translate it for other HP calculators as well.

HP-15C:
Code:
   001 {       44  0 } STO 0
   002 {       43 35 } g CLx
   003 {    42 21  0 } f LBL 0
   004 {       45  0 } RCL 0
   005 {          36 } ENTER
   006 {       43 11 } g x²
   007 {          40 } +
   008 {          36 } ENTER
   009 {       43 11 } g x²
   010 {          20 } ×
   011 {          15 } 1/x
   012 {          30 } −
   013 {    42  5  0 } f DSE 0
   014 {       22  0 } GTO 0
   015 {           1 } 1
   016 {           0 } 0
   017 {          40 } +
   018 {          11 } √x̅

HP-25:
Code:
01: 23 00    : STO 0
02: 00       : 0
03: 21       : x<->y
04: 31       : ENTER
05: 15 02    : g x^2
06: 51       : +
07: 31       : ENTER
08: 15 02    : g x^2
09: 61       : *
10: 15 22    : g 1/x
11: 41       : -
12: 24 00    : RCL 0
13: 01       : 1
14: 41       : -
15: 23 00    : STO 0
16: 15 61    : g x<>0
17: 13 04    : GTO 04
18: 22       : Rv
19: 01       : 1
20: 00       : 0
21: 51       : +
22: 14 02    : f SQRT
23: 13 00    : GTO 00

We can even do it on the HP-35 if we consider the following manual steps a program.

Initialize:
Code:
CLR
10  STO

Repeat until 0:
Code:
ENTER↑  ENTER↑  ×  +
ENTER↑  ENTER↑  ×  ×
1/x  -
RCL  1  -  STO

Finalize:
Code:
R↓
10  +
√x


While we could start subtracting the terms from an initial value of 10, it is better to start the summation from 0 to avoid cancellation.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Pi Approximation Day - Gerson W. Barbosa - 07-22-2022, 11:47 PM
RE: Pi Approximation Day - J-F Garnier - 07-23-2022, 11:44 AM
RE: Pi Approximation Day - C.Ret - 07-23-2022, 03:18 PM
RE: Pi Approximation Day - C.Ret - 07-23-2022, 05:18 PM
RE: Pi Approximation Day - Steve Simpkin - 07-24-2022, 11:59 AM
RE: Pi Approximation Day - Thomas Klemm - 07-23-2022, 02:20 AM
RE: Pi Approximation Day - J-F Garnier - 07-23-2022, 07:00 AM
RE: Pi Approximation Day - Albert Chan - 07-23-2022, 10:56 AM
RE: Pi Approximation Day - vaklaff - 07-23-2022, 11:26 AM
RE: Pi Approximation Day - Thomas Klemm - 07-23-2022 06:46 PM
RE: Pi Approximation Day - Didier Lachieze - 07-23-2022, 09:09 PM
RE: Pi Approximation Day - Thomas Klemm - 07-24-2022, 07:03 AM
RE: Pi Approximation Day - Dan C - 07-24-2022, 09:37 AM
RE: Pi Approximation Day - Dan C - 07-24-2022, 11:29 AM
RE: Pi Approximation Day - Thomas Klemm - 07-24-2022, 11:30 AM
RE: Pi Approximation Day - Ajaja - 07-24-2022, 01:28 PM
RE: Pi Approximation Day - Thomas Klemm - 07-24-2022, 03:52 PM
RE: Pi Approximation Day - Albert Chan - 07-24-2022, 07:13 PM
RE: Pi Approximation Day - pauln - 07-24-2022, 06:39 PM
RE: Pi Approximation Day - EdS2 - 07-24-2022, 09:10 PM
RE: Pi Approximation Day - pauln - 07-24-2022, 11:27 PM
RE: Pi Approximation Day - Thomas Klemm - 07-24-2022, 10:16 PM
RE: Pi Approximation Day - Albert Chan - 07-25-2022, 12:03 AM
RE: Pi Approximation Day - Thomas Klemm - 07-25-2022, 06:38 AM
RE: Pi Approximation Day - Thomas Klemm - 07-25-2022, 09:28 PM
RE: Pi Approximation Day - Albert Chan - 07-26-2022, 12:51 AM
RE: Pi Approximation Day - pauln - 07-26-2022, 01:27 AM
RE: Pi Approximation Day - Albert Chan - 07-26-2022, 12:27 PM
RE: Pi Approximation Day - Thomas Klemm - 07-26-2022, 05:24 AM
RE: Pi Approximation Day - Thomas Klemm - 07-26-2022, 01:38 PM
RE: Pi Approximation Day - EdS2 - 08-03-2022, 04:53 PM
RE: Pi Approximation Day - Thomas Klemm - 08-07-2022, 11:42 AM



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