Post Reply 
An iteration produces all the prime numbers
02-17-2021, 01:00 AM
Post: #12
RE: An iteration produces all the prime numbers
.
Hi, EdS2:

(02-16-2021 03:34 PM)EdS2 Wrote:  13 digits - that's odd

Correct. 13 is indeed an odd integer.

Quote:I see the HP-71B described as having 12 digits. Can you explain please, Valentin?

Yes. The value featured in your linked article is 2 followed by 12 decimals, i.e., 13 digits in all.

To get the full 12 decimals in a 12-digit calc the integer part (2) gets in the way so my program simply gets rid of it by initializing the sum to -1, thus no integer part is ever involved and the 12-digit HP-71B can merrily compute the 12-digit decimal part in its full glory (.920050977316), then it's a matter of just adding the 2 in front when printing and there you are, 2.920050977316, 13 digits.

Quote:I wonder if there's any extended precision library for the 71B or any other HP calculator, to allow us to work with more digits?

Well, computing multiprecision results with the HP-71B is not that difficult at all once you've done it a few times, just for instance have a look at these PDf articles I wrote:

      HP-71B Producing Digits of Pi one at a time
      HP-71B Multiprecision E and its roots

which can compute thousands of digits of Pi and e (and its roots, square, etc), respectively. As for a multiprecision "library", have a look at the one I wrote for this challenge o'mine:

      HP Challenge VA021 - Short Sweet Math Challenge 20 April 1st Spring Special

and in page 74 you'll find the following (abridged here):

Appendix A: The multiprecision library

I'll briefly discuss here the small(just 32 lines of code) "Ad-hoc multiprecision library" I've implemented specifically for this particular subchallenge (the following listing is numbered as if to be included in the same file as the main program without line numbers conflicting, but could reside in a separate program file in RAM as well, if intended to be used by other programs).

      SUB MMUL(A(),B(),C())       { Multiprecision MULtiplication }
      SUB MPOW(A(),N,C())       { Multiprecision POWer }
      SUB MSUM(A(),B(),C())       { Multiprecision SUM }
      SUB MSBI(A(),B())       { Multiprecision SuBtraction In-place }
      SUB MMODK(A(),K,M)       { Multiprecision MODulus single-precision }
      SUB MDIVK(A(),K)       { Multiprecision DIV (and modulus) single-precision }
      SUB MNOR(A())       { Multiprecision NORmalization }
      SUB MTOP(A(),U)       { Multiprecision TOP }
      SUB M2N(A(),N)       { Multiprecision to real-precision Numeric variable }
      SUB N2M(N,A())       { Numeric Real-precision variable to Multiprecision }
      SUB MMOD(A(),B(),C())       { Multiprecision MODulus }
      SUB MFAC(N,A())       { Multiprecision FACtorial }


Sample use:

      69! MOD 1368 = 161707119156747337147933149666645422128978599226831537632782504385470771962

However, do not have any high hopes, it was written ad-hoc for the challenge so it's not general purpose by any means, though it might be useful to you as an example on how to proceed (read the Caveats).

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


Messages In This Thread
RE: An iteration produces all the prime numbers - Valentin Albillo - 02-17-2021 01:00 AM



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