| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Prime numbers |
> I did one using an integer based square root
> function which
> only checks one less than or one greater than
> multiples of
> six, which all primes seem to be for some reason.
> :)
I did one for the Z80 using bits. You just reset successively all bits
representing mutiples of all previous primes, and what remains a 1 must
represent a prime. 18 seconds to go through the entire 4 megabytes of bank
switched 64KB memory, IIRC.
It should work well enough for 32bit or wider machines, too, but it's
at its best in assembler rather than C.
Best wishes,
Bill.
---
* Origin: Meerkats Anonymous (2:2504/200)SEEN-BY: 396/1 622/419 632/371 633/260 267 270 371 634/397 635/506 728 810 SEEN-BY: 639/252 670/213 218 @PATH: 2504/200 213 2503/501 252/356 140/1 270/101 396/1 633/260 635/506 728 @PATH: 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.