![]() |
Primality tests
I understand you need some code to implement in a computer program. please specify the OS platform and programming language you preffer to work with and i'll see what i can do.
From what i gather you need to test primes up to 20 digits, is this correct? Please reply here or at the user forum at [url]www.shteker.com[/url] |
I'm using win98 and c++
mostly i wirte my programs with the help of the MIRACL libary or the giantint library |
Some basic background information on trial factoring.
Only need to test to the square root of the number. For numbers expressed in base ten the square root will be at most one more than half the number of digits as the number your trying to factor. A 15 digit number would have 8 digits max for the square root. All primes except 2 and 3 are 6x +/- 1 with x = 1 ... so the factor mod 6 must be either 1 or 5 to be a potential prime. A 64 bit unsigned integer can hold a 20 digit number (18446744073709551615 max). |
but trial factoring a 20 -digit number take a while!!!
I want to implement a primility test where i know theat the number is 100% prime!!! |
[QUOTE=andi314]so which other methods could i use to determine that a number is 100% prime???[/QUOTE]
For numbers having no special form, there are a number of algorithms you could try, e.g. APRCL (named after its inventors), ECPP, or the recent deterministic AKS algorithm. Do a Google search on any of these and you'll find background info and in most case freeware implementations. The practical limit of these seems to be 5000-10000 digits at present - proving any number < 100 digits or so would be virtually instantaneous via these methods. |
| All times are UTC. The time now is 15:09. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.