IsItPrime v1.7.0
30 August 2012
by NullCoding (Jaska)
http://ncprime.blogspot.com
http://sourceforge.net/projects/isitprime
///////////////////////////
About:
This is a small and basic, yet powerful and highly configurable prime-number tester.
Unlike other NCPrime applications, IsItPrime does not calculate a specific type of number. It tests whatever number you tell it to test.
Version 1.7.0 is a testing beta. It is considered stable enough to run on most modern Windows systems.
///////////////////////////
How to use:
1. Input a number in the box.
2. Select a testing method using the radio buttons (BFTD or SPAT).
3. Select a testing range using the other radio buttons (up to square root or up to n).
4. (Optional) check the box for verbose mode and/or to play sound when a factor is found.
5. Press TEST!
6. Save your results if you wish. You can even Tweet them.
///////////////////////////
Known issues:
The threads don't communicate with each other that well - yet. This doesn't have any adverse effects (of which I'm aware), but it does make things a tad difficult to understand at some points. For example, you need to add up the amount of factors found (if any), since each thread only tells you about itself - no one else.
///////////////////////////
Notes:
IsItPrime is multi-threaded. This does not mean it runs in separate processes, merely separate threads. These threads are independant, meaning they do not communicate (non-mutex) and therefore must each perform their own primality test.
Sometimes, one thread will find several factors but the other finds none. They are "smart threads," so they check out each others' results immidiately before exiting to determine their exit behavior. If each finds out that the other found no factors, the number is said to be prime, whereas if one finds factors and the other does not, they point you to the other thread's results.
Reading and interpreting results from each of the three parallel testing threads should be easy enough.
Results files, when saved, will show all the factors regardless of which thread found them.
Additionally, tweets will not show results, merely the test number (and only if it's not too long!)
///////////////////////////
Brute-Force
Only brute-force trial division currently has the option to show every factor. This is entirely optional, but useful if your primary goal is to factor a number.
BFTD will run in verbose or non-verbose mode. The latter will stop after one thread (any thread) finds a single factor for which the quotient is not one (that is, it checks to be positive that it's not testing the candidate number itself!)
Verbose mode stops upon reaching the candidate number. It deliberately tests past your number in order to have a benchmark. If it realizes your number is suddenly smaller than the trial division number, it knows it's gone too far and stops.
The program will warn you about length and computation time regardless of how big the candidate number actually is. However, it's got a point - large numbers can take several minutes to several hours or longer to test! Since there is essentially no limit to the length of the number you can input, be careful. The application is stable, but CPU-intensive. Memory usage is dealt with well enough and should NOT be a problem.
Currently, there is no implementation for testing up to the square root using brute force in verbose mode. There is really no point unless you are genuinely curious about how many factors lie in the range only up to the square root. The point of verbose mode is to display absolutely every factor. If you limit your testing range to <sqrt(n), then you will obviously not find every factor.
///////////////////////////
Still to come:
- Possibly, mutex threads with a central array of factors so it can tell you how many there really are
-
Upon finding a "prime," re-test the selected range and display remainders so as to be absolutely sure none of them are zero
- Hopefully, the ability to pause an in-progress test will be implemented as soon as I figure out exactly how!