RPL exercise - Last Digits of Primes (HP 49G, G+, 50g)
06-04-2019, 03:00 AM (This post was last modified: 06-04-2019 03:05 AM by Gerson W. Barbosa.)
Post: #28
 Gerson W. Barbosa Senior Member Posts: 1,603 Joined: Dec 2013
RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g)
(06-01-2019 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.

40 --> {7 12 11 10}

120 --> {27 33 30 30}

1000 --> ?

Ok, that’s trivial from any of the base-10 programs. Anyway, for the sake of completeness, here is a 34-step program for the wp34s based on Dave Britten’s base-10 program for the DM42/HP-42S:

Code:
 001 LBL A 002 STO A 003 CLx 004 FILL 005 STOS 01 006 STOS 05 007 # 001 008 TICKS 009 STO 02 010 LBL 00 011 R↓ 012 INC X 013 INC X 014 PRIME? 015 XEQ 01 016 RCL 04 017 x<? A 018 GTO 00 019 TICKS 020 RCL- 02 021 STO 02 022 RCL 01 023 RCL 03 024 RCL 05 025 RCL 07 026 RTN 027 LBL 01 028 INC 04 029 RCL X 030 # 008 031 MOD 032 INC→X 033 R↓ 034 END

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 (low-battery condition)

or

RCL 02 -> 469 (USB-powered)
 « Next Oldest | Next Newest »

 Messages In This Thread RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Gerson W. Barbosa - 06-01-2019, 03:07 AM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Valentin Albillo - 06-01-2019, 04:13 AM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Gerson W. Barbosa - 06-01-2019, 04:43 AM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - DavidM - 06-01-2019, 05:02 AM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Gilles - 06-01-2019, 05:29 AM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Albert Chan - 06-01-2019, 12:42 PM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Gerson W. Barbosa - 06-01-2019, 05:44 AM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Carsen - 06-01-2019, 08:51 AM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - grsbanks - 06-01-2019, 12:48 PM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Valentin Albillo - 06-01-2019, 02:38 PM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Gerson W. Barbosa - 06-01-2019, 03:29 PM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Valentin Albillo - 06-01-2019, 09:59 PM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Gerson W. Barbosa - 06-02-2019, 10:43 PM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Valentin Albillo - 06-02-2019, 11:27 PM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Gerson W. Barbosa - 06-03-2019, 12:14 AM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Valentin Albillo - 06-03-2019, 04:25 AM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Gerson W. Barbosa - 06-01-2019, 03:17 PM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Gerson W. Barbosa - 06-01-2019, 03:41 PM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - DavidM - 06-01-2019, 04:08 PM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Gerson W. Barbosa - 06-01-2019, 09:11 PM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Dave Britten - 06-01-2019, 11:05 PM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Gerson W. Barbosa - 06-02-2019, 06:10 PM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - John Keith - 06-02-2019, 04:39 PM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Gilles - 06-02-2019, 09:18 PM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Carsen - 06-03-2019, 03:49 AM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Gerson W. Barbosa - 06-03-2019, 01:08 PM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Carsen - 06-03-2019, 08:15 PM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Gerson W. Barbosa - 06-04-2019 03:00 AM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - fred_76 - 06-04-2019, 02:21 PM RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - ttw - 06-04-2019, 05:09 PM

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