Quote:
Originally Posted by 10metreh
Here is some Pari code to run your test for numbers n+2 from 1 to 10000, and print the false positives along with a counter:
Code:
x=0;for(n=1,9998,if(isprime(n+2)==0&&(2^n1)%(n+2)==(n+1)/2,x++;print(x" "n+2)))
Here is its output:
Code:
1 341
2 561
3 645
4 1105
5 1387
6 1729
7 1905
8 2047
9 2465
10 2701
11 2821
12 3277
13 4033
14 4369
15 4371
16 4681
17 5461
18 6601
19 7957
20 8321
21 8481
22 8911
Here is some code to run Fermat's test to base 2 for n from 1 to 10000, and similarly print the false positives:
Code:
x=0;for(n=1,10000,if(isprime(n)==0&&(2^(n1))%n==1,x++;print(x" "n)))
Here is its output:
Code:
1 341
2 561
3 645
4 1105
5 1387
6 1729
7 1905
8 2047
9 2465
10 2701
11 2821
12 3277
13 4033
14 4369
15 4371
16 4681
17 5461
18 6601
19 7957
20 8321
21 8481
22 8911
Does that look at all familiar?

Hi 10metreh
OMG. It is exactly THE SAME.
I accept now that the algorithm is a "clone" and that it is a repitition of Fermat. I shall not persue this matter any further.
I apologise to all the contributors that tried to unsuccessfully point this out to me for wasting your time all the while.
Now all that remains, if anybody might be interested, would be how I derived "my" algorithm. I did not reference to Fermat.
Oh my goodness!