Prime Number Primality Testing

236 Views Asked by At

I've developed a code and method that works in tandem with an earlier prime number algorithm I developed here:

https://codereview.stackexchange.com/questions/54753/a-fast-approach-to-prime-number-sieving-non-threaded-array

I have used it to determine whether LARGE numbers are prime or not in a fast amount of time along with why its not prime (if it isn't).

I have found in less than three seconds that 192,841,749,213,451,283 is PRIME according to my methods - I am restricted due to Java array size and memory space to 18 significant digits right now.

How can I test whether my results are correct - despite lower numbers being all accurate? I can't find a resource online that will let me test these numbers, given time.

1

There are 1 best solutions below

10
On

Your result is not correct, since $$ 192841749213451283=11\cdot883\cdot1300573\cdot15265567 $$

I used PARI/GP to check this. You may wish to download it (it's free) to check the numbers on your own, or use any of a number of free online solutions.

As a quick check, use your program to find the primes up to $2^n$ for small $n$ and XOR (^) the results. You should get

10 627
11 1084
12 2345
13 499
14 4115
15 9929
16 18275
17 72458
18 203653
19 67941
20 877734
21 59156
22 2750
23 3971644
24 1045936
25 6886568
26 11789200
27 37712294
28 133154824
29 496378615
30 52560007

and this should at least show that your program is generally working.