HP Forums

Full Version: Euler-Mascheroni Constant – (HP-15C and HP-42S)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The goal is to make the Euler-Mascheroni Constant available on the HP-15C and the HP-42S, rounded to 10 and 12 digits, using the least number of steps and the least byte-count, respectively. On the latter a truncated result should be nice as well. This is not being presented as a challenge, but rather as a request for sharing better solutions I am not aware of. Thanks in advance!

HP-15C:

Code:

   001 { 42 21 12 } f LBL A
   002 {        1 } 1
   003 {        0 } 0
   004 {        4 } 4
   005 {        8 } 8
   006 {        1 } 1
   007 {       15 } 1/x
   008 {       48 } .
   009 {        4 } 4
   010 {       40 } +
   011 {        2 } 2
   012 {    43 12 } g ln
   013 {       10 } /
   014 {    43 32 } g RTN

Code:

   001 { 42 21 11 } f LBL A
   002 {        5 } 5
   003 {        7 } 7
   004 {        7 } 7
   005 {        2 } 2
   006 {        1 } 1
   007 {        5 } 5
   008 {        6 } 6
   009 {        6 } 6
   010 {        4 } 4
   011 {        9 } 9
   012 {    44 36 } STO 36
   013 {    45 36 } RCL 36
   014 {    43 32 } g RTN

HP-42S:

Code:

00 { 21-Byte Prgm }
01▸LBL "g"
02 PI
03 SQRT
04 3.2581173
05 E↑X-1
06 1/X
07 -
08 1/X
09 END

Code:

00 { 19-Byte Prgm }
01▸LBL "g"
02 1.7324547146
03 1/X
04 END

Listings by JRPN and Free42 simulators, respectively.
Reference URL's