Author: Uri Blass
Date: 03:08:51 05/28/05
Go up one level in this thread
On May 28, 2005 at 05:24:51, Joseph Tadeusz wrote: >On May 27, 2005 at 11:12:52, Vincent Diepeveen wrote: > >>A retry : >> >>// Diepeveen test to find mersenne primes >>// test whether p is prime p = 2^n - 1 >>// when given n is prime >> >>t = 3; >>for( j = 1 ; j < n ; j++ ) >> t = t*t; // mod p >> if( t == p-3 ) printf("prime\n"); else printf("composite\n"); >> >>3 >>9 >>19 >>20 >>28 <==> p-3 = 31 - 3 = 28 >> >>Vincent > >Does this also work for primes larger than 31? I do not know if it works for all of them. It works for 127 1)t=3 2)t=9 3)t=81 4)t=6561 mod 127=84 5)t=7056 mod 127=71 6)t=5041 mod 127=88 7)t=7744 mod 127=124 124=127-3 127 is prime. Uri
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.