[VA] SRC #016 - Pi Day 2024 Special
|
03-14-2024, 06:20 PM
Post: #1
|
|||
|
|||
[VA] SRC #016 - Pi Day 2024 Special
Hi, all, Once again, today it's March, 14 aka \(\pi\) Day, so Happy \(\pi\) Day 2024 and Welcome to SRC #16 - Pi Day 2024 Special
As always, this SRC #16 is intended to commemorate this super-ubiquitous constant, \(\pi\). I've been posting a number of threads over the years about \(\pi\) Day, these are the four previous ones:
SRC #010 - Pi Day 2022 Special SRC #009 - Pi Day 2021 Special SRC #006 - Pi Day 2020 Special: A New Fast Way to Compute Pi In due time I'll post my original code for the HP-71B and/or HP-42S/Free42, once you've had the opportunity to work on them for a few days. Oh, and sorry, no cake this time, we've ran out of cake !
1. First appearance First of all: what do I consider a rare \(\pi\) appearance ? Well, broadly speaking mostly any unexpected appearances of \(\pi\) having nothing to do with circles or other geometric matters (including arc lengths, areas, volumes, etc.,) such as e.g. the one shown by this 2-line, 69-byte HP-71B program: 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 That said. let's begin with the first appearance: Solve this equation for x in [1, 6]. Post both result and code or keystroke sequence. 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:
2. Check if they are co-prime, 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 Post both code and results. My original solution is a 3-line, 102-byte HP-71B program which outputs the resulting values for N=10, 100, 1000, ..., one million tries. 3. Third appearance Solve this equation for x, where \(\phi\) is the Golden Ratio = (1+√5)/2. Post both result and code or keystroke sequence: My original solution is a 2-line, 91-byte HP-71B program which outputs the resulting values of x for 10, 100, 1000, ..., 100,000 terms in the infinite product, and also a 2-line command line sequence which solves for x by using 100,000 terms straight away. 4. Fourth appearances Although \(\pi\) can't appear in its entirety within an irrational algebraic number (because \(\pi\) is transcendental and thus not the root of a non-zero polynomial of finite degree with rational coefficients,) \(\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:
√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 5. Fifth appearances As stated above, \(\pi\) can't be a root of polynomial equations with rational coefficients but that doesn't prevent \(\pi\)'s prefixes of arbitrary finite length from appearing as roots of particular equations, e.g.: Solve the following equations, either using a program or directly from the keyboard. Remember, don't post just the result, include also the code or keystroke sequence:
6. Sixth appearance Given the following recurrence, with x0 = 0 and { } denoting the fractional part function, 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, then manually check whether each dn matches the nth hexadecimal digit of \(\pi\)'s fractional part, and if they do then maybe, just maybe, this recurrence quite unexpectedly produces \(\pi\)'s hex digits one at a time, as do spigot algorithms ! For example, the first 50 hex digits of \(\pi\)'s fractional part are 3.243F6A8885 A308D31319 8A2E037073 44A4093822 299F31D008 so your program should output: 2 4 3 F 6 A 8 8 8 .. Try and output as many correct hex digits as possible, which will depend on your model's range (10-digit, 12-digit, ..) and/or whether your code uses/implements multiprecision arithmetic or not. My original solution consists of a 3-line, 112-byte HP-71B program which correctly produces the first 9 hex digits above, and a 49-step, 89-byte HP-42S program which when run on Free42 Decimal produces the first 26 correct hex digits. 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. My original solution is a one-line command-line BASIC expression for the HP-71B as well as a 15-step, 28-byte RPN Solver program for the HP-42S or Free42. Well, that's all for now. If I see interest, I'll post in a few days my original solutions, including results, code (or keystroke sequences) and relevant comments. My code is for the HP-71B and/or the HP-42S/Free42 but you might consider posting RPN, RPL, SysRPL or 71FORTH/Assembler code as well. V. All My Articles & other Materials here: Valentin Albillo's HP Collection |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)