Post Reply 
RPL exercise - Last Digits of Primes (HP 49G, G+, 50g)
06-02-2019, 06:10 PM (This post was last modified: 06-02-2019 09:34 PM by Gerson W. Barbosa.)
Post: #19
RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g)
(06-01-2019 11:05 PM)Dave Britten Wrote:  ...

This finds and tallies 1000 primes in about 25 seconds on my DM42 when running in fast mode (i.e. connected to external power).


100 000 primes in 143.01 seconds on my smartphone.

Here is a wp34s version:

Code:

001 LBL A
002 STO A
003 CLx
004 FILL
005 STOS 01
006 STOS 06
007 # 005
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 SDR 001
022 RTN
023 LBL 01
024 INC 04
025 RCL X
026 # 010
027 MOD
028 INC→X
029 R↓
030 END

Running time in seconds in register X. Last digits counts in registers 01, 03, 07 and 09.

100 000 primes in 14.3 seconds on the smartphone

1000 primes in 73.5 seconds on the wp34s.

P.S.:

10 000 0000 primes in about 45 minutes on the smartphone.

1: 2 499 756
3: 2 500 208
7: 2 500 284
9: 2 499 752
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: RPL exercise - Last Digits of Primes (HP 49G, G+, 50g) - Gerson W. Barbosa - 06-02-2019 06:10 PM



User(s) browsing this thread: