[VA] Short & Sweet Math Challenge #25 "San Valentin's Special: Weird Math"
|
02-25-2021, 09:04 PM
(This post was last modified: 02-25-2021 09:22 PM by PeterP.)
Post: #33
|
|||
|
|||
RE: [VA] Short & Sweet Math Challenge #25 "San Valentin's Special: Weird Math...
Challenge 2, HP41, Sandbox module, unsophisticated, straight forward RPN.
Lbl 'AS 2021 STO 00 ;HP 41 is very slow with numbers 2 + 1/x STO 01 ; First factor, STO 02 ; Sum 2 St* 01 ;build second factor RCL 00 3 STO 11 ;Current Prime + ST/ 01 GTO 05 ;calculate sum LBL 06 ;find next prime RCL 11 ; current prime STO L LBL 00 ;prime finding loop LastX 2 + PRIME? GTO 01 GTO 00 LBL 01 View X ;show current prime X <> 11 ; Store current prime X <> 10 ; Put old current prime into last Prime LBL 02 RCL 10 ; Last Prime ST* 01 RCL 00 RCL 11 + ST/ 01 ; update current factor LBL 05 ; calc sum RCL 01 ST+ 02 View 02 ; View Current Sum GTO 06 The sum very quickly converges to 1/2021 or, to be more precise, after some sleuthing using different constants, to 1/A with A being the constant added in the denominator. Some sleuthing shows that its also irrelevant that the sum uses the prime numbers, one could use any sequence of numbers, even a constant 1 (ie sum of 1/(2021+1)^k). doing a little bit more paper sleuthing on this, one can see that the numerator becomes a O(A^n) and the denominator O(A^(n+1)), meaning the sum trends to 1/A. Cheers, PeterP |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)