RPL exercise  Last Digits of Primes (HP 49G, G+, 50g)

06022019, 10:43 PM
Post: #21




RE: RPL exercise  Last Digits of Primes (HP 49G, G+, 50g)
(06012019 09:59 PM)Valentin Albillo Wrote: Hello, Valentin, Thank you very much for the HP71B version, much appreciated! I’ve noticed, however, FPRIM() is not a standard HP71B function. I assume it’s a LEX file, a Language EXtension file by what I can remember. So, my question – not addressed exclusively to you, but to whom else can answer it – is: what is the easiest way to implement it on the real HP71B or at least on Emu71? Thanks in advance. Best regards, Gerson. 

06022019, 11:27 PM
Post: #22




RE: RPL exercise  Last Digits of Primes (HP 49G, G+, 50g)
.
Hi, Gerson: (06022019 10:43 PM)Gerson W. Barbosa Wrote: Thank you very much for the HP71B version, much appreciated! The easiest way to implement it on the real HP71B or on Emu71 is by plugging in the JPC ROM, which is where the FPRIM keyword and dozens of others reside, and that is what I always do with my HP71B, because an HP71B it's not a "real" HP71B but an emasculated one unless you fit it with a Math ROM, a JPC ROM and an HPIL ROM. Oh, and a 128 Kb CMT RAM module, for good measure. That's the power HP machine I use at all times and have been saying and advocating that much for the last 20+ years in this and the old forum, nothing new here. Frankly, I don't quite see why RPL machines can use this or that library all the time without anyone raising an eyebrow (me included) and the moment I use a "library" (a ROM) with my HP71B someone goes and asks what is "the easiest way to implement it on the real HP71B". Is my HP71B unreal to you or what ? I take it that you don't use any libraries with your RPL models, then ? Best regards. V. . All My Articles & other Materials here: Valentin Albillo's HP Collection 

06032019, 12:14 AM
(This post was last modified: 06032019 12:17 AM by Gerson W. Barbosa.)
Post: #23




RE: RPL exercise  Last Digits of Primes (HP 49G, G+, 50g)
(06022019 11:27 PM)Valentin Albillo Wrote: The easiest way to implement it on the real HP71B or on Emu71 is by plugging in the JPC ROM, which is where the FPRIM keyword and dozens of others reside, and that is what I always do with my HP71B, because an HP71B it's not a "real" HP71B but an emasculated one unless you fit it with a Math ROM, a JPC ROM and an HPIL ROM. Oh, and a 128 Kb CMT RAM module, for good measure. Here ✓ Math ROM ✗ JPC ROM ✓ HPIL ROM ✓ 32 KB RAM Plus card reader, HP9114B diskdrive and proper floppies, IPIL cables. JPC ROM still missing... Best regards, Gerson. 

06032019, 03:49 AM
Post: #24




RE: RPL exercise  Last Digits of Primes (HP 49G, G+, 50g)
(06012019 12:48 PM)grsbanks Wrote:(06012019 08:51 AM)Carsen Wrote: ...test if the digit is a 1, 3, 7, 9, or none of the aboveHow could it be none of the above? Oops. You're right. A simple impetuous mistake on my part. (06012019 02:38 PM)Valentin Albillo Wrote:(06012019 08:51 AM)Carsen Wrote: Here's my take on the challenge. The algorithm is very straightforward. Get the next prime number, put it in a string, retrieve the last digit in the string [...] Okay. That makes a lot of sense, especially after I single stepped (SST) through DavidM's first RPL program that he posted in this thread because he did exactly what you described Valentin. After reflecting other's variants of code, this exercise will remind me how useful the MOD function can be in programming because I never really use it. (06012019 03:17 PM)Gerson W. Barbosa Wrote: Just two remarks: Nice! Save 3 seconds in Exact mode! I sure like that. I have a question on remark 1 Gerson. Why should my STR> be replaced with an OBJ>? Thanks everyone! 

06032019, 04:25 AM
Post: #25




RE: RPL exercise  Last Digits of Primes (HP 49G, G+, 50g)
.
G'day, Gerson, (06032019 12:14 AM)Gerson W. Barbosa Wrote: JPC ROM still missing... Try this link: JF Garnier's JPC ROM for the HP71B. There you'll find a treasure trove full of all kinds of manuals, guides, docs and of course binary images that you can immediately use with most any emulators such as Emu71 and even Android ones for your phone. I'm using Version F in both Win XP and Android. I'm not fully sure but I think that someone described how to burn the image to a physical EPROM or whatever hardware, to use the JPC ROM in a physical HP71B. Perhaps you'd want to try. For the record, I used the amazing JPC ROM functionalities to help me solve about 100 Project Euler problems, it was highly entertaining to do that with such old software & hardware ! Best regards. V. . All My Articles & other Materials here: Valentin Albillo's HP Collection 

06032019, 01:08 PM
Post: #26




RE: RPL exercise  Last Digits of Primes (HP 49G, G+, 50g)
(06032019 03:49 AM)Carsen Wrote:(06012019 03:17 PM)Gerson W. Barbosa Wrote: Just two remarks: My mistake, sorry! It didn’t work for me because I picked >STR from the menu instead of typing in STR>. 

06032019, 08:15 PM
Post: #27




RE: RPL exercise  Last Digits of Primes (HP 49G, G+, 50g)
(06032019 01:08 PM)Gerson W. Barbosa Wrote:(06032019 03:49 AM)Carsen Wrote: Nice! Save 3 seconds in Exact mode! I sure like that. Lol. Good thing you mentioned OBJ> though. I somehow forgot OBJ> parses strings. This must mean I haven't programmed my 50g enough recently 

06042019, 03:00 AM
(This post was last modified: 06042019 03:05 AM by Gerson W. Barbosa.)
Post: #28




RE: RPL exercise  Last Digits of Primes (HP 49G, G+, 50g)
(06012019 03:07 AM)Gerson W. Barbosa Wrote: Optionally, write a program that does the same for primes greater than 2 in base 8. In this case, the last digits are 1, 3, 5 and 7. Ok, that’s trivial from any of the base10 programs. Anyway, for the sake of completeness, here is a 34step program for the wp34s based on Dave Britten’s base10 program for the DM42/HP42S: Code:
1000 A > 253 R↓ > 254 R↓ > 252 R↓ > 241, that is, 241 1’s, 252 3’s, 254 5’s and 253 7’s. Running time in tenths of seconds in register 02: RCL 02 > 730 (lowbattery condition) or RCL 02 > 469 (USBpowered) 

06042019, 02:21 PM
(This post was last modified: 06042019 02:37 PM by fred_76.)
Post: #29




RE: RPL exercise  Last Digits of Primes (HP 49G, G+, 50g)
Some interesting paper to understand the countings:
https://dms.umontreal.ca/~andrew/PDF/PrimeRace.pdf 

06042019, 05:09 PM
(This post was last modified: 06042019 05:13 PM by ttw.)
Post: #30




RE: RPL exercise  Last Digits of Primes (HP 49G, G+, 50g)
Adding to Fred's suggested paper (which is really worth reading) is this Guy's paper.
https://www.ime.usp.br/~rbrito/docs/2322249.pdf One of the examples: D. H. & Emma Lehmer discovered that 2^n=3 (mod n) for n = 4700063497, but for no smaller n > 1. 

« Next Oldest  Next Newest »

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