Post Reply 
[HP35s] Program for prime number (Wheel Sieve and Miller-Rabin)
02-12-2019, 08:14 PM (This post was last modified: 02-15-2019 01:02 PM by Albert Chan.)
Post: #6
RE: Hello and program for prime number (HP35s)
Hi, fred_76

Termination code may be optimized a bit.

Instead of testing factor^2 > n, you can pre-calculate number of prime-wheel turns needed.

Example, N = 99999 999977
ceil( √N ) = 316228
Max wheel turns = ceil((316228-7)/30) = 10541, simple loop count to 0 suffice.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Hello and program for prime number (HP35s) - Albert Chan - 02-12-2019 08:14 PM



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