20171228, 16:11  #56  
Feb 2017
3×5×11 Posts 
Quote:
I use very basic SAGEMATH code, as listed in post #50. Since the algorithm is very simple (straight math calculations), the results for M7, M13, M19, M31 returns positive when I run it in SAGEMATH code. 

20171228, 16:13  #57  
Feb 2017
245_{8} Posts 
Quote:
Which thread should I look at on the page that comes up? 

20171228, 16:17  #58 
"Forget I exist"
Jul 2009
Dartmouth NS
2×3×23×61 Posts 

20171228, 16:19  #59  
Feb 2017
3·5·11 Posts 
Quote:
Perhaps somebody else can run the code in SAGEMATH...the code is fairly straight forward since the algorithm is also simple. I will try to put it more "formally" looking at SAGE code posted by other users. I will try to grap screen an example, but sinnce I am running SAGEMATH in "VMWare Workstation software, I can't seem to do that. 

20171228, 16:54  #60  
Feb 2012
Prague, Czech Republ
3·67 Posts 
Quote:
Source Code:
package main import ( "fmt" "math/big" "github.com/cznic/mathutil" "github.com/cznic/mathutil/mersenne" ) var ( _1 = big.NewInt(1) _2 = big.NewInt(2) ) func main() { var tests, ok, falsePos, falseNeg int var negs []uint32 var last uint32 n := uint32(2) for n <= mersenne.Knowns[21] { last = n n, _ = mathutil.NextPrime(n) _, prime := mersenne.Known[n] // http://www.mersenneforum.org/showpost.php?p=475141&postcount=50 // // #1......a=2^71..................Divisor under test~127....n2 // #2......b=(2^71)2.............n~125 // #3......c=1/2*(b+1).............Target Congruant~63 // #4......d=2^b1...................Dividend~42,535,295,865,117,307,932,921,825,928,971,026,431 // #5.......e=d mod a..............Congruant~63 // #6.......c==e.......................True~127(divisor) is Prime a := mersenne.New(n) var b, c big.Int b.Sub(b.Set(a), _2) c.Div(c.Add(c.Set(&b), _1), _2) x := mathutil.ModPowBigInt(_2, &b, a) x.Sub(x, _1) conj := x.Cmp(&c) == 0 tests++ switch { case prime == conj: ok++ case prime: falseNeg++ negs = append(negs, n) default: falsePos++ } } fmt.Printf("False negatives: %8d\n", falseNeg) fmt.Printf("False positives: %8d\n", falsePos) fmt.Printf("Correct results: %8d\n", ok) fmt.Printf("Prime exponents: %8d (tests performed)\n", tests) fmt.Printf("Last exponent: %8d\n", last) fmt.Println("False negatives:") for _, v := range negs { fmt.Printf("\tM_%d\n", v) } } Code:
~/src/tmp/main> go build && time ./main False negatives: 0 False positives: 1205 Correct results: 21 Prime exponents: 1226 (tests performed) Last exponent: 9941 False negatives: real 1m10.533s user 1m11.096s sys 0m0.428s ~/src/tmp/main>
Last fiddled with by jnml on 20171228 at 16:55 Reason: s/mersenne.Knowns[22]/mersenne.Knowns[21]/ 

20171228, 17:28  #61  
"Forget I exist"
Jul 2009
Dartmouth NS
2×3×23×61 Posts 
Quote:
Last fiddled with by science_man_88 on 20171228 at 17:31 

20171228, 18:24  #62 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2
274B_{16} Posts 

20171228, 18:33  #63 
Feb 2012
Prague, Czech Republ
3·67 Posts 

20171228, 23:23  #64 
Feb 2017
3×5×11 Posts 
false positives
Hi njml and batalov
I get the following running the Algorithm in SAGEMATH False Positives identified by the algorithm; 0100..............0 ~100 value, number of odd numbers tested would be half 01,000............3 010,000...........22 0100,000..........78 01,000,000........245 pi(x)~78,498 primes less than 1,000,000 (primes.utm.edu) and therefore potentially 421,502 odd numbers that could be potentially "false positives". The actual false positives up to 1,000,000 according to the algorithm (run in SAGE) is therefore approx. 0.058% No false negatives encountered up to 1,000,000. 
20171229, 00:06  #65  
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2
10059_{10} Posts 
Quote:
This is the same as: 2^(n+1)2 = n+1 (mod n+2) . . . . . . (equivalent to mulitply both sides by 2 because n is odd) 2^(n+1) = n+3 (mod n+2) . . . . . . . . rearrange, subtract n+2... 2^(n+1) = 1 (mod n+2) which is the 2PRP test for n+2, not for n. Why would this test work for n? It "sort of" works for n+2, for sure. But what does it have to do with the primality of n?? 

20171229, 00:20  #66 
"Forget I exist"
Jul 2009
Dartmouth NS
2×3×23×61 Posts 

Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
gpuOwL: an OpenCL program for Mersenne primality testing  preda  GpuOwl  2910  20230205 19:37 
GQQ: a "deterministic" "primality" test in O(ln n)^2  Chair Zhuang  Miscellaneous Math  21  20180326 22:33 
AouessareEl HaddouchiEssaaidi "test": "if Mp has no factor, it is prime!"  wildrabbitt  Miscellaneous Math  11  20150306 08:17 
"New primality proving test from Alex Petrov"  ewmayer  Math  11  20070423 19:07 
P1 B1/B2 selection with "Test=" vs "Pfactor="  James Heinrich  Software  2  20050319 21:58 