Post Reply 
[VA] SRC #016 - Pi Day 2024 Special
03-19-2024, 01:27 AM (This post was last modified: 03-19-2024 03:57 AM by Valentin Albillo.)
Post: #21
RE: [VA] SRC #016 - Pi Day 2024 Special
      
Hi, all,

First of all, thank you very much to all of you who posted in this thread for your interest and appreciation, let alone your valuable contributions. A few comments before I post my original solutions. Let's see ,,.

Gerson W. Barbosa Wrote:I’ll take the opportunity to present my own polynomial equation of that kind:

x7 + 2 x6 + 3 x5 + 4 x4 + 3 x3 + 2 x2 + x - 19100/3 = 0

I was expecting you to come with a fantastic input for Pi Day and true to form, you certanly delivered with that awesome "symmetric" equation, Gerson, which I'd never seen before and which I do like it, a lot.

This kind of equations can be reduced by using the change of variable x = z + 1/z, which almost halves the degree, so your equation would be reduced from 7th-degree (usually unsolvable algebraically, thus requiring hyperelliptic functions) to 4th-degree, which is algebraically solvable.

C.Ret Wrote:I am trying hard to solve this equation with my HP-15C, hoping that numeric integration, solver and hyperbolic trigonometric are of any use.

They certainly are and thanks for participating. I know that you like to be able to use physical calcs in my challenges (as opposed to ultra-fast virtual ones) so these 7 appearances are perfectly suited for you.

J-F Garnier Wrote:The most memorable unexpected appearance of pi for me was with the expression: sum(n=1 to Inf,1/n²) = π²/6. So simple ...

Well, come to that this is much simpler:

      [Image: 2a0b6b57cfd88db9c30a65ae647df063af02dfb5]

J-F Garnier Wrote:Here is my keystroke sequence on the 71B, with my Math 2B to save a few keystrokes:

Indeed, those INTEG, IX, FROOT, FX keywords really help, perhaps it even fits in just one line when you also omit the A variable (else you need a DESTROY ALL to guarantee A is not a matrix).

I've always hated those needlessly verbose INTEGRAL, FNROOT, IVAR and FVAR keywords, most especially when you've got a puny 22-char display. I wonder who was the inept that decided on those names, probably the same one that decided to waste 2.5 Kb in the useless abomination known as CALC mode or the unused 5 Kb in the original Math Pac, among other assorted imbecilities.

J-F Garnier Wrote:While experimenting a bit, I found a few interesting similar expressions:

Yes, they're nice alright but not that similar as they do not involve ϕ, the Golden Ratio, which is what I find appealing about this appearance (reversing the equation, \(\pi\), a mighty transcendental number, appears as a simple function of ϕ, the simplest irrational algebraic number and a modest, unassuming infinite product.)

J-F Garnier Wrote:I like these two ones!

Here we are with π approximations, not exact value given by infinite series.

Thank you and yes, among the 7 appearances dealt with here some are exact (in the limit) and others are prefixes of \(\pi\) (the N first digits for various N). For such simple equations, these two are very close approximations.

C.Ret Wrote:The next appearance is expected in no less than 243 hrs (10 days)

Also, 243 = 35, twin primes ! Smile

jonakeys Wrote:edit: remove code panel since it's not allowed

Thanks for removing them, jonakeys, and also for including the keycodes in the nicely formatted program listings. Also, congratulations, you nailed the results.

ttw Wrote:All the funny Pi stuff connects with a circle, not necessarily directly from a circle, but maybe through angles.

O RLY ? Pray tell, where do you find the connection with circles or angles here, in this example I posted at the beginning of my OP ? Wink

    1 DESTROY ALL @ RANDOMIZE 260 @ FIX 4 @ INPUT K
    2 N=0 @ FOR I=1 TO K @ N=N-MOD(IROUND(RND/RND),2) @ NEXT I @ DISP 1-4*N/K


    >RUN

    ? 1E5 ->
    3.1416

Or perhaps in the GCD-related Second appearance in my OP ? Do you think the GCD (Greatest Common Divisor) function has something to do with circles or angles ? Please explain how come.

DavidM Wrote:If the past is any predictor of the future, I'm sure that Valentin's version will be speedy i[...] Smile

Well, not this time. I didn't intend for this to be a regular challenge but a nice celebration of \(\pi\). I just wanted interested people to write simple, minimal code or key sequences to get various incarnations of \(\pi\) to appear on their calc's displays, so no complicated programming, no clever tricks, no timings, just seeing \(\pi\) show up in unexpected places. Thus, this time my original solutions are no better and in particular no faster than those posted here, which are pretty good to begin with. Smile



I'll post my original solutions and comments next Thursday so you've got still a few days to try and post solutions to the remaining, yet-to-address appearances, namely the 4th, 6th and 7th. Gotta Catch 'Em All !

V.
Edit: two typos.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
03-19-2024, 05:37 PM
Post: #22
RE: [VA] SRC #016 - Pi Day 2024 Special
6th, on Free42:

00 { 83-Byte Prgm }
01▸LBL "A6"
02 0
03 STO 00
04 SIGN
05 STO 01
06▸LBL 00
07 RCL 01
08 ENTER
09 ENTER
10 ENTER
11 512
12 ×
13 LASTX
14 RCL+ ST L
15 -
16 ×
17 712
18 +
19 ×
20 206
21 -
22 ×
23 21
24 +
25 R↓
26 R↓
27 120
28 ×
29 89
30 -
31 ×
32 16
33 +
34 X<>Y
35 ÷
36 16
37 RCL× 00
38 +
39 FP
40 STO 00
41 16
42 ×
43 IP
44 HEXM
45 STOP
46 SIGN
47 STO+ 01
48 GTO 00
49 END

XEQ A6
->
2 R/S ->
4 R/S ->
3 R/S ->
F R/S ->
6 R/S ->

E R/S ->
0 R/S ->
3
Find all posts by this user
Quote this message in a reply
03-19-2024, 09:14 PM
Post: #23
RE: [VA] SRC #016 - Pi Day 2024 Special
ArcTan(x) has the power series: Sum (over k) -1^k * x^(2k) +1)/(2k+1).
ArcTan(1)=Pi/4
Pi/4=1-1/3+1/5-1/ 7...
Find all posts by this user
Quote this message in a reply
03-19-2024, 09:57 PM (This post was last modified: 03-19-2024 09:59 PM by Gerson W. Barbosa.)
Post: #24
RE: [VA] SRC #016 - Pi Day 2024 Special
7th:

When trying to simplify the polynomial equation x³ - 6x² + 4x - 2 = 0, I noticed the change of variable x = y + 2 reduces it to the incomplete cubic equation y³ - 8y - 10 = 0, of the type y³ + p y + q = 0, which can be solved by Cardano’s formula. The real root (only one in this case) is given by

y = (-q/2 + √d)^(1/3) + (-q/2 - √d)^(1/3),

where d = (p/3)^3 + (q/2)^2

and

p = -8; q = -10

Thus

y = (5+√(163/27))^(1/3)+(5-√(163/27))^(1/3))

and

x = 2 + (5+√(163/27))^(1/3)+(5-√(163/27))^(1/3)) = 5.318628217750185659109680153318022

By replacing x in the given expression we get, on Free 42,

log((2+(5+√(163/27))^(1/3)+(5-√(163/27))^(1/3))^24-24)/√163 = 3.141592653589793238462643383279503

which matches exactly all the 34 digits of the built-in constant. The difference to \(\pi\) is about 3.14e-34 in excess, which makes this approximation quite suitable for Free42.

The value of the real root of the second polynomial equation can also be given by a more compact expression (see Valentin’s HP-15C Mini-Challenge: Impossibly Short !? for details), which I have used to evaluate the full expression on Free42:

y = 4 √(2/3) cosh(1/3 acosh((15 √(3/2))/16))

00 { 50-Byte Prgm }
01▸LBL "A7"
02 4
03 2
04 3
05 ÷
06 SQRT
07 ×
08 LASTX
09 1/X
10 15
11 ×
12 16
13 ÷
14 ACOSH
15 3
16 ÷
17 COSH
18 ×
19 2
20 +
21 24
22 Y↑X
23 RCL- ST L
24 LN
25 163
26 SQRT
27 ÷
28 END

XEQ A7
->

3.141592653589793238462643383279503
Find all posts by this user
Quote this message in a reply
03-20-2024, 08:16 AM
Post: #25
RE: [VA] SRC #016 - Pi Day 2024 Special
(03-14-2024 06:20 PM)Valentin Albillo Wrote:  Let x be the only real root of

      x3 - 6 x2 + 4 x - 2 = 0

Compute ln(x24 - 24) ÷ H, where H is the number of hours in a week minus five.

The most amazing appearance !

Numerically solving the equation on Free42, I got a similar result as Gerson:

LBL "F7"
MVAR "X"
RCL "X"
ENTER
ENTER
ENTER
6
-
*
4
+
*
2
-
RTN


SOLVE "F7" for X between 1 and 9
then compute:
RCL "X" , 24 , Y^X , 24 , - , LN , 163 , SQRT , /
result = 3.141592653589793238462643383279504
within 1 ULP (1E-33) from the built-in PI constant !

Now, let's have a look at X:
X = 5.318628217750185659109680153318024
and X^24 = 262537412640768767.9999999999992527
is very close to an integer.
Also H = number of hours in a week minus five = 24*7-5 = 163.

This reminds us the famous approximation:
\(\pi\) ~ ln(640320^3+744) / √(163)
based on the so-called Ramanujan's constant.

Here the approximation is even better because the value X^24-24 itself is an excellent approximation of this Ramanujan's constant, coming from the root of a very simple 3rd-degree polynomial. Amazing !

J-F
Visit this user's website Find all posts by this user
Quote this message in a reply
03-20-2024, 02:42 PM (This post was last modified: 03-20-2024 02:47 PM by Gerson W. Barbosa.)
Post: #26
RE: [VA] SRC #016 - Pi Day 2024 Special
(03-20-2024 08:16 AM)J-F Garnier Wrote:  Here the approximation is even better because the value X^24-24 itself is an excellent approximation of this Ramanujan's constant, coming from the root of a very simple 3rd-degree polynomial. Amazing !

If a tiny bit involving 640320² and a few other perfect squares is added to the second 24 constant then the approximation gets even more amazing:

log((2+(5+1/3√(163/3))^(1/3)+(5-1/3√(163/3))^(1/3))^24-(24+1/((32^2+36^2)*640320^2+(41^2+105^2)/69^2)))/√163

or

\[\frac{\ln\left[{\left({2+\sqrt[3]{5+\frac{1}{3}\sqrt{\frac{163}{3}}}+\sqrt[3]{5-\frac{1}{3}\sqrt{\frac{163}{3}}}}\right)^{24}-\left({24+\frac{1}{\left({32^2+36^2}\right)\times640320^2+\frac{41^2+105^2}{69^2​}}}\right)}\right]}{\sqrt{163}}\]


But then Free42 ought to be twice as precise in order to properly evaluate it.

Gerson.
Find all posts by this user
Quote this message in a reply
03-20-2024, 06:31 PM (This post was last modified: 03-20-2024 08:17 PM by J-F Garnier.)
Post: #27
RE: [VA] SRC #016 - Pi Day 2024 Special
Sorry for a slightly OT comment, but the root computed by Gerson:
(03-19-2024 09:57 PM)Gerson W. Barbosa Wrote:  x = 2 + (5+√(163/27))^(1/3)+(5-√(163/27))^(1/3)) = 5.318628217750185659109680153318022

differs from the root found by the Free42 solver:
(03-20-2024 08:16 AM)J-F Garnier Wrote:  X = 5.318628217750185659109680153318024

and I had to understand the cause ...

Looking closely at the Free42's solver outputs with 1 and 9 as initial estimates, we see:
z:0.000000000000000000000000000000036
y:5.318628217750185659109680153318014
x:5.318628217750185659109680153318024

This means the Free42 solver found a sign reversal in f(x) between the values in X and Y, with a value f(X)=3.6e-32, but contrary to the classic HP algorithms, the two numbers in X and Y are not neighbour (they differ by more than 1 ULP).
All that Free42 is telling us is that the root is between the values reported in X and Y.
But the value in X may not be the best result.

We can manually get a more accurate root, with an error less than 1 ULP:
1E-33 , STO- "X" , XEQ "F7":
f(5.318628217750185659109680153318023) = 1.4e-32
1E-33 , STO- "X" , XEQ "F7":
f(5.318628217750185659109680153318022) = -1.3e-32
this is the true sign reversal, and choosing the estimate with the smallest f(x) magnitude, we can then fully agree with Gerson's result. All is safe !

J-F
Visit this user's website Find all posts by this user
Quote this message in a reply
03-21-2024, 11:33 AM
Post: #28
RE: [VA] SRC #016 - Pi Day 2024 Special
(03-20-2024 02:42 PM)Gerson W. Barbosa Wrote:  \[\frac{\ln\left[{\left({2+\sqrt[3]{5+\frac{1}{3}\sqrt{\frac{163}{3}}}+\sqrt[3]{5-\frac{1}{3}\sqrt{\frac{163}{3}}}}\right)^{24}-\left({24+\frac{1}{\left({32^2+36^2}\right)\times640320^2+\frac{41^2+105^2}{69^2​}}}\right)}\right]}{\sqrt{163}}\]

or, more compactly,

\[\frac{\ln\left[{\left({2+\sqrt[3]{5+\frac{\sqrt{489}}{9}}+\sqrt[3]{5-\frac{\sqrt{489}}{9}}}\right)^{24}-24-\frac{1}{2320\times640320^2+\frac{12706}{69^2}}}\right]}{\sqrt{163}}\]
3.14159265358979323846264338327950288419716939937510582097494459(320)
Find all posts by this user
Quote this message in a reply
03-24-2024, 02:54 PM
Post: #29
RE: [VA] SRC #016 - Pi Day 2024 Special
I was curious to see the impact of digit counts with Appearance 6, so I put together two separate RPL versions to check it. These were then run on an emulated 50g for testing.

The first uses built-in (standard) RPL commands to compute a 50-character hex string result:

«
  ""                                    @ hex string initial result
  0.                                    @ x0
  1. 50. FOR x                          @ loop x for 50 hex digits
    16. *                               @ 16x(n-1)
    [120 -89 16] x PEVAL                @ numerator polynomial evaluated
    [512 -1024 712 -206 21] x PEVAL     @ denominator polynomial evaluated
    / +                                 @ compute fraction, accumulate value
    FP                                  @ we only need the fractional part
    
    DUP                                 @ leave a copy of x(n) for next pass
    16. * IP                            @ IP(16x)                                                       
    10. OVER >                          @ convert digit value to ascii character
    48. 55. IFTE
    + CHR
    
    ROT SWAP + SWAP                     @ append character to hex string
  NEXT
  DROP                                  @ x no longer needed
»



This provided the following result, yielding 9 accurate digits:
243F6A8882 396F57BAB5...

RPL has no built-in multi-precision utilities for floating-point calculations, so I opted to use the LongFloat library to see what kind of impact the digit count had on the final result:

\<<
  ""
  0. R\<-\->F
  1. 50. FOR x
    16. R\<-\->F FMULT
    '(120*x^2-89*x+16)/(512*x^4-1024*x^3+712*x^2-206*x+21)' \->FNUM
    FADD FFP
    DUP
    R\<-\->F 16. * IP
    10. OVER >
    48. 55. IFTE
    + CHR ROT SWAP + SWAP
  NEXT
  DROP
\>>


Repeated runs with increasing numbers of multiple-precision digits showed improvements, as expected:

MP Digit Count    Hex string matching digits
--------------    --------------------------
12                9
25                20
34                26
40                32
50                40
60                49
62                50

I'm curious as to how the MP digit count compares with other implementations (Python, Lua, etc.). Has anyone else tried this?
Find all posts by this user
Quote this message in a reply
03-24-2024, 08:30 PM
Post: #30
RE: [VA] SRC #016 - Pi Day 2024 Special
      
Hi, all,
     
Well, time to post my original solutions. As I said, my intent is to celebrate unusual \(\pi\) appearances by encouraging interested people to write simple code to put various incarnations of \(\pi\) right on the display. Thus, my solutions are pretty plain-vanilla code with no real regard for optimization or speed. That said, here we go:

1. First appearance

Solve this equation for x in [1, 6].

      [Image: pI%2003.jpg]
      
These two HP-71B command-line sequences will do the job right from the keyboard, namely:

   >DESTROY ALL @ STD @ I=INTEGRAL(0,1,1E-10,ATAN(ATANH(IVAR))/IVAR) -> 1.02576051092
   >FNROOT(1,6,FVAR*(LN(GAMMA(1/FVAR))-LN(GAMMA(1/2+1/FVAR))-LN(FVAR)/2)-I)

      3.14159265358


and, as \(\pi\) is 3.14159265359 when rounded to 12 digits, we've got the correct value save 1 ulp.

The value obtained is exact in the limit, not an approximation. The first command-line sequence computes the definite integral, then the second one solves the equation. Were it not for the 96-char command-line length restriction, both lines could be merged into a single one and then neither the DESTROY ALL statement nor the temporary I variable assignment would be needed.

I chose this particular expression because I liked the arctan(arctanh(...)) composite function on aesthetical grounds. Furthermore, this definite integral has a closed-form exact value, which is quite infrequent for integrals of transcendental composite functions, and it's not trivial to numerically compute to full accuracy so that the subsequent solve procedure can work with the best value obtainable.

2. Second appearance

You can get a nice approximation to the value of \(\pi\) (exact as the number of tries goes to infinity) by following these simple steps. First set Count to zero and select a number of tries N, then:
    1. Choose two random integers A and B in [1, N].
    2. Check if they are coprime, i.e. they have no common factors, in which case increment Count. Keep on performing steps 1 and 2 for N tries, then:
    3. Output [Image: SRC-13-1-1-tuorjj.jpg]

This 3-line, 102-byte HP-71B program will output the value obtained by using 10, 100, 1000, ..., 1,000,000 tries:

   1  DESTROY ALL @ RANDOMIZE 1 @ FOR K=1 TO 6 @ N=10^K @ T=0
   2  FOR I=1 TO N @ T=T+(GCD(IP(RND*N+1),IP(RND*N+1))=1) @ NEXT I 
   3  DISP USING "8D,2X,D.4D";N,SQR(6*N/T) @ NEXT K
    >RUN
            10   2.9277
           100   3.2733
          1000   3.1755
         10000   3.1448
        100000   3.1449
       1000000   3.1415  (1 ulp)  
The convergence to \(\pi\) is extremely slow but it's happening. Two integers A and B are coprime if their greatest common divisor (GCD) is 1. My solution above uses the JPC ROM's GCD function to check every pair A, B of randomly generated integers, while keeping a tally of how many coprimes were found.

Why does this procedure produce \(\pi\) ? Because the probability PN that two randomly chosen integers in [1, ..., N] are coprime approaches 6/\(\pi\)2 as N tends to infinity, and you can derive \(\pi\) from that value.

3. Third appearance

Solve this equation for x, where \(\phi\) is the Golden Ratio = (1+√5)/2.

     [Image: Pi%20phi%20b.jpg]

This 2-line, 91-byte HP-71B program will output the root obtained by using 10, 100, 1000, ..., 100,000 terms of the infinite product. It does not use any solver but simply isolates x :

   1  DESTROY ALL @ FOR K=1 TO 5 @ P=1 @ FOR N=1 TO 10^K @ P=P*(1-1/(100*N*N)) @ NEXT N
   2  DISP USING "8D,2X,D.6D";N-1,5/(P*(1+SQR(5))/2) @ NEXT K
    >RUN
            10   3.138604
           100   3.141280
          1000   3.141561
         10000   3.141590
        100000   3.141592

or simply from the command line, directly using 100,000 terms of the product:

   >DESTROY ALL @ FIX 6 @ K=(1+SQR(5))/2
   >P=1 @ FOR N=1 TO 10^5 @ P=P*(1-1/(100*N*N)) @ NEXT N @ 5/(P*K)

      3.141592


For 12-digit models such as the HP-71B, there's no point in using more than 100,000 terms of the product, as no additional accuracy will be obtained and in fact the rounding errors resulting from multiplying so many terms will begin to degrade the accuracy noticeably while also greatly increasing the run time.

I chose this particular appearance of \(\pi\) because I liked the fact that it produced the exact (in the limit) value of \(\pi\) from \(\phi\) and a short, unremarkable infinite product, as if \(\phi\) was the one which begat \(\pi\) ... Smile

4. Fourth appearances

\(\pi\)'s prefixes of any length (first N digits of \(\pi\) for finite N) do actually appear inside irrational numbers, square roots for instance, like these:
    ● The 7-long prefix 3141592 appears in:

         3485  =  59.033888...4733453141592349004..  at decimal 822
         26401 = 162.483845...1905663141592268465..  at decimal  69
         82777 = 287.709923...3523123141592695866..  at decimal  45
       (8-long, actually !)
       
    ● The 10-long (rounded) prefix 3141592654 appears in:

         2424609  = 1557.115602...6896933141592654600235..  at decimal 170
         40850970 = 6391.476355...4838773141592654698929..  at decimal 112
See if you can find other appearances of assorted \(\pi\)'s prefixes in various irrationals. The smaller the argument and the earlier the appearance, the better.



I was hoping that interested readers would look into the matter and come up with some interesting appearances of \(\pi\)'s prefixes in other irrational values, perhaps within logs, trigs or exponentials but it wasn't to be, though I didn't require posting code so people could use more powerful harware/software, yet no one tried. A pity.

As for the appearances I posted, I believe them to be a fine compromise between smaller arguments and nearer locations for the first appearances inside the irrational value.

Of course you can always find prefixes of any length even for arguments as small as 2 (i.e. √2) but they'll first appear at tremendously deep locations, or else you can find the prefix beginning at the very first decimal place but for enormously large arguments. Thus the need to compromise.

5. Fifth appearances

Solve the following equations, either using a program or directly from the keyboard:
  • Polynomial:  4 x3 - 22 x2 + 29 x + 2 = 0  and  9 x4 - 19 x3 + 28 x2 - 70 x - 344 = 0
  • Fermat-like:  2063x + 8093x = 8128x  and   1198x + 4628x = 4649x
  • Transcendental (where Γ is the Gamma function):   Γ ln(7 x5/19) = 16
See if you can find similar polynomial equations with roots even closer to \(\pi\). The smaller the degree and the size of the coefficients, the better.



These HP-71B command-line sequences will suffice, no programming needed:
    ● The first polynomial equation is solved by this sequence:

       >FIX 6 @ FNROOT(3,4,((4*FVAR-22)*FVAR+29)*FVAR+2)  ->  3.141593

          
    ● The second polynomial equation is solved by this sequence:

       >FIX 9 @ FNROOT(1,6,(((9*FVAR-19)*FVAR+28)*FVAR-70)*FVAR-344)  ->  3.141592654


    ● The first Fermat-like equation is solved by this sequence:

       >FIX 10 @ FNROOT(1,6,2063^FVAR+8093^FVAR-8128^FVAR)  ->  3.1415926535
       (1 ulp)

    ● The second Fermat-like equation is solved by this sequence:

       >STD @ FNROOT(1,6,1198^FVAR+4628^FVAR-4649^FVAR) ->  3.14159265363
       (4 ulp)

    ● The transcendental equation is solved by this sequence:

       >FIX 10 @ FNROOT(1,16,GAMMA(LN(7/19*FVAR^5))-16) ->  3.1415926535
       (1 ulp)
All the roots are approximate values of \(\pi\), none are exact. The two polynomials are what I believe to be the minimal polynomials of degrees 3 and 4, i.e. the ones with the smallest coefficients for the achieved accuracy, and I found them with what I jokingly call my "Poor's Man PSLQ", which is actually a very simple search (not related to true PSLQ, mind you) with several tricks and optimizations applied to help run the search faster.

I used a similar ad-hoc approach to find the very short & simple transcendental equation, which I consider amazingly remarkable as it's got a root so close to \(\pi\) while featuring just 6 digits, 2 functions and 3 arithmetic operations in all. How's that for economy of resources ?

6. Sixth appearance

Given the following recurrence, with x0 = 0 and { } denoting the fractional part function,

      [Image: Pi%20recurrence.jpg]

write a program to compute its succesive terms x1, x2, x3, .. and for each term output in hexadecimal the value of dn = IP(16 xn ), where IP is the integer part function. Try and output as many correct hex digits as possible.



My original solution for the HP-71B is this 3-line, 112-byte plain-vanilla program:
    1  DESTROY ALL @ X=0 @ FOR N=1 TO 9 @ M=4*N
    2  X=FP(16*X+(30*M^2-89*M+64)/(8*M^4-64*M^3+178*M^2-206*M+84))
    3  DISP BSTR$(IP(16*X),16);" "; @ NEXT N @ DISP

       >RUN  ->  2 4 3 F 6 A 8 8 8

and produces the first 9 (next is 2 instead of the correct 5) hexadecimal digits of \(\pi\)'s fractional part.

Using 12-digit arithmetic (HP-71B, HP-42S, etc.) that's the most correct digits we can get but using multiprecision arithmetic it's possible to obtain many more, e.g. using the 34-digit Free42 Decimal emulator with my 49-step, 89-byte program below:

      01  LBL "HEXPI"  13   x     25  X<>Y        37  RCLx 00     49  END
      02   0           14  64     26  X^2         38   +
      03  STO 00       15   -     27  30          39  FP
      04   1           16   x     28   x          40  STO 00
      05  STO 01       17  178    29  89          41  16
      06 ►LBL 00       18   +     30  RCLx ST T   42   x
      07   4           19   x     31   -          43  IP
      08  RCLx 01      20  206    32  64          44  HEXM
      09  ENTER        21   -     33   +          45  STOP
      10  ENTER        22   x     34  X<>Y        46  ISG 01
      11  ENTER        23  84     35   ÷          47  LBL 00
      12   8           24   +     36  16          48  GTO 00 ►

Executing XEQ "HEXPI" and pressing [R/S] after each digit shown we get:

      2 4 3 F 6 A 8 8 8 5 A 3 0 8 D 3 1 3 1 9 8 A 2 E 0 3

and the next hex digit is 6, which should be 7 so we've got 26 correct hex digits in all.

This recurrence has been checked up to 1,000,000 terms (i.e. hex digits, all of them correct) and it's known that there can only be a finite number of incorrect digits, if at all.

Furthermore, if the sequence of xi happens to be uniformly distributed in [0-1] (as indeed it seems to be the case,) then this would imply the normality of \(\pi\) in base 2 (and thus in base 16 as well,) which would be a far-ranging, all-important achievement worthy of a Fields Medal or two, so perhaps you might want to try. Wink

Last but not least, I was hoping from the get-go that some of you would use one of the powerful RPL models with multiprecision capabilities to get many more hex digits and luckily lo and behold, DavidM fulfilled my expectations. If any of you would like to try, these are the first 500 hex digits of \(\pi\) (ignore the 3.) for you to check your results:

   3.243F6A8885 A308D31319 8A2E037073 44A4093822 299F31D008 2EFA98EC4E 6C89452821 E638D01377 BE5466CF34 E90C6CC0AC
     29B7C97C50 DD3F84D5B5 B547091792 16D5D98979 FB1BD1310B A698DFB5AC 2FFD72DBD0 1ADFB7B8E1 AFED6A267E 96BA7C9045
     F12C7F9924 A19947B391 6CF70801F2 E2858EFC16 636920D871 574E69A458 FEA3F4933D 7E0D95748F 728EB65871 8BCD588215
     4AEE7B54A4 1DC25A59B5 9C30D5392A F26013C5D1 B023286085 F0CA417918 B8DB38EF8E 79DCB0603A 180E6C9E0E 8BB01E8A3E
     D71577C1BD 314B2778AF 2FDA55605C 60E65525F3 AA55AB9457 48986263E8 144055CA39 6A2AAB10B6 B4CC5C3411 41E8CEA154


7. Seventh appearance

Let x be the only real root of

      x3 - 6 x2 + 4 x - 2 = 0

Compute ln(x24 - 24) ÷ H, where H is the number of hours in a week minus five.



This HP-71B command-line sequence will return the root, an approximation to \(\pi\) correct to a full 12 digits:

   >STD @ LN(FNROOT(1,10,FVAR^3-6*FVAR^2+4*FVAR-2)^24-24)/SQR(24*7-5) @ PI

      3.14159265359

      3.14159265359


but again, using the 34-digit Free42 Decimal arithmetic capabilities we can check whether there's additional accuracy to unfold. Using this trivial 15-step, 28-byte Solver program below, we can conduct the following session right from the keyboard:

   01  LBL "PIEQ"   09   x
   02  MVAR "X"     10   4
   03  RCL "X"      11   +
   04  ENTER        12   x
   05  ENTER        13   2
   06  ENTER        14   -
   07   6           15  END
   08   -


   - [SOLVER] -> Select Solve Program
   - Touch PIEQ, 0, touch X, touch X -> 5.31862821775
   - Press EXIT twice, 24, y^x, 24, -, LN, 24, ENTER, 7, x, 5, -, SQRT, ÷

           3.14159265359

   - Press and hold SHOW -> 3.141592653589793238462643383279504   (34 correct digits save 1 ulp)

thus this extremely simple procedure can produce ~ 34 correct digits of \(\pi\) with utmost, unexpected simplicity. Amazing indeed !



Well, that'll be all for now.

Thank you very much for your interest to all of you who posted solutions and comments, namely Gerson W. Barbosa, J-F Garnier, DavidM, C.Ret, ttw, Juan14, johnb and jonakeys, much appreciated and I'm glad you enjoyed it.

See you all next April 1st. Smile

V.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
03-26-2024, 10:27 PM
Post: #31
RE: [VA] SRC #016 - Pi Day 2024 Special
Bravo, Valentin!

Some remarkable constructions there. I felt compelled to look into them a bit. I share some notes for other interested parties.

For the Fermat-like equations in the 5th appearance, I found the first appears in a 2000 paper by Elkies, but I can't find anything on the second - any pointers?

For the hex digits of pi in the 6th appearance, I found a 2001 paper by Bailey and Crandall with the conjecture that there's never a carry from the tail of the sequence into the current digit. (Found via the OEIS)

For that 7th appearance, I found some hints of the construction behind the approximation in the Wikipedia page on Heegner numbers.
Find all posts by this user
Quote this message in a reply
03-27-2024, 11:49 PM
Post: #32
RE: [VA] SRC #016 - Pi Day 2024 Special
(03-24-2024 08:30 PM)Valentin Albillo Wrote:   If any of you would like to try, these are the first 500 hex digits of \(\pi\) (ignore the 3.) for you to check your results:
...

Re: Appearance 6

The following shows how many multi-precision digits were needed to successfully compute the indicated number of pi hex digits when using the LongFloat library in my previous post. I also included timing info for both a real 50g as well as Emu48 running a 50g instance on my desktop computer:

Pi Hex       LongFloat DIGITS  Duration HP 50g  Duration Emu48 
Digit Count  Required          (seconds)        (seconds)
-----------  ----------------  ---------------  --------------

9            12                  10.6696           0.0552
12           17                  14.4429           0.0739
15           20                  18.0243           0.0942
25           32                  30.3909           0.1541
50           62                  65.6283           0.3373
75           94                 109.7356           0.5425
100          122                166.0343           0.8069
200          242                584.6167           2.6566
300          363               1473.9006           6.5126
400          483               3060.8020          12.9928
500          603               5566.3005          23.1306
600          724               -                  38.7625
700          844               -                  59.5496
800          965               -                  86.4680
900          1085              -                 121.5936
1000         1206              -                 164.3663
2000         2410              -                1269.4080


Thanks Valentin for the celebration!
Find all posts by this user
Quote this message in a reply
03-28-2024, 11:37 PM
Post: #33
RE: [VA] SRC #016 - Pi Day 2024 Special
.
Hi, DavidM,

(03-27-2024 11:49 PM)DavidM Wrote:  Re: Appearance 6

The following shows how many multi-precision digits were needed to successfully compute the indicated number of pi hex digits when using the LongFloat library in my previous post. I also included timing info for both a real 50g as well as Emu48 running a 50g instance on my desktop computer [...]

Thank you very much, DavidM, an excellent batch of results and a great demonstration of your RPL model's power, be it in physical or virtual form, much appreciated.

Come to think about it, your calc's multi-precision capabilities would be ideal to have a go at the 4th Appearances sub-challenge, which it's been left orphaned so far. You can try and get an appearance of a \(\pi\)'s prefix of some non-trivial length in a trig, log, or exponential irrational number, such as the often-neglected e, for instance ? Smile

Quote:Thanks Valentin for the celebration!

You're welcome, thanks to you for your appreciation and your worthwhile results, they surely took a sizable amount of time (and batteries!) to obtain.

Best regards.
V.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
03-29-2024, 12:35 PM
Post: #34
RE: [VA] SRC #016 - Pi Day 2024 Special
(03-28-2024 11:37 PM)Valentin Albillo Wrote:  Come to think about it, your calc's multi-precision capabilities would be ideal to have a go at the 4th Appearances sub-challenge, which it's been left orphaned so far. You can try and get an appearance of a \(\pi\)'s prefix of some non-trivial length in a trig, log, or exponential irrational number, such as the often-neglected e, for instance ? Smile

I actually did do a few runs with Appearance 4, but only using the square root method of your example. Then Appearance 6 caught my attention, and I never cycled back to experiment with other options. When time permits I'll try that again. So far, I've identified 171 instances of at least "3141592" using 1000 for the DIGITS setting. I've got some gaps in the ranges of testing, though.

(03-28-2024 11:37 PM)Valentin Albillo Wrote:  ...they surely took a sizable amount of time (and batteries!) to obtain.

No worries there, as I was running on USB power for the real 50g tests. Smile
Find all posts by this user
Quote this message in a reply
Post Reply 




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