Author: Joseph Tadeusz
Date: 02:24:51 05/28/05
Go up one level in this thread
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?
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.