The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
[VA] SRC #013 - Pi Day 2023 Special
03-14-2023, 06:22 PM (This post was last modified: 03-18-2023 02:16 AM by Valentin Albillo.)
Post: #1
[VA] SRC #013 - Pi Day 2023 Special
  
Hi, all,
          
Just in case you hadn't noticed, today it's March, 14 aka \(\pi\) Day, so

Happy Pi Day 2023 and Welcome to my SRC #13 - Pi Day 2023 Special

[Image: Laura%20Albillo%20Pi%20Day%202023%20Cake.jpg]
(We just enjoyed this nice Pi Day's Oreo cake for lunch, courtesy of my daughter Laura's haute cuisine abilities)

This SRC #13 is intended to commemorate once more this most ubiquitous constant, \(\pi\). There are many other threads about Pi Day 2023 but this one is mine. After posting a number of threads over the years about \(\pi\) Day, such as these, it would seem problematic to find new, intriguing appearances of the little critter but far from it, \(\pi\) is well-nigh inexhaustible and to prove the point let me introduce a couple' additional appearances for your enjoyment, which will appear one after another so that you can focus on just one at a time. Let's begin with #1 ...
    Note: No hard rules so no need for a parallel thread, post here whatever you want as long as it's on topic and NO CODE PANELS, but I'd appreciate it if you'd use vintage HP calcs (physical/virtual), otherwise I'll consider you to have failed the challenge whatever your results/timings.

1. Let's count ...

\(\pi\)'s value can be obtained by evaluating a plethora of transcendental functions, infinite summations and products, definite integrals, stochastic processes, etc., but if you don't remember any of them you can still get a nice approximation to the value of \(\pi\) (exact as N goes to infinity) by following these simple steps:
    1. Choose a positive integer N

    2. Tally up how many integers in the range 1...N have no repeated prime factors
      
    3. Output [Image: SRC-13-1-1-tuorjj.jpg]
For example, for N = 10 we find that the seven integers 1, 2, 3, 5, 6, 7 and 10 have no repeated prime factors, so Count = 7 and you get ~ 2.9277 as an approximation to \(\pi\) (err ~ 6.8%).

Now write your very own program and try N = 12,345, 100,000, 567,890 and 1,000,000 to see if you get the following results, which I obtained using this little witty 4-line (217-byte) HP-71B program I wrote for the occasion (uses Math and JPC ROMs; 179 bytes without USING "image"):
    1  DESTROY ALL @ INPUT T @ SETTIME 0 @ ...
    2  ...
    3  ...
    4  DISP USING "2(3DC3DC3DC3D,2X),2(Z.8D,X),5DZ.2D";T,S,SQR(6*T/S),ABS(PI-RES),TIME

       >RUN ->  ? 12345  -> ... , etc.

         N      Count    \(\pi\) approx    |Error|     go71b  Emu71/Win  Physical
                                                 @128x    @976x     HP-71B
    ------------------------------------------------------------------------
       12,345    7,503  3.14198205  0.00038939    0.10"    0.01"       13"
      100,000   60,794  3.14155933  0.00003333    0.28"    0.04"       36"
      567,890  345,237  3.14158684  0.00000582    0.69"    0.09"    1' 28"
    1,000,000  607,926  3.14159550  0.00000285    0.93"    0.12"    1' 59"
However, as the procedure is so simple, the difficulty here lies not so much in the programming as in the efficiency, thus the challenge consists mainly in achieving correct results in times as good or better than the ones given above, using exclusively vintage HP calcs, physical or virtual (indicate emulation's speed and timings for the virtual/physical calcs and try to avoid prematurely spoiling it all for other people.)

Well, see if you can deliver and, if feeling venturous and your calc is up to it, post also the results and timings for N = 10 million, 25 million and 33 million (which gives an approximation to \(\pi\) correct to 8 digits.)

If I see interest, I'll post my original solution & comments in a few days and part #2 next April, 1st.

That's all. Any and all constructive and on-topic comments will be most welcome and appreciated.

V.
Edit: some errors corrected.

  
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
Post Reply 


Messages In This Thread
[VA] SRC #013 - Pi Day 2023 Special - Valentin Albillo - 03-14-2023 06:22 PM



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