Release calc version 2.10.3t5.45

This commit is contained in:
Landon Curt Noll
1997-10-04 20:06:29 -07:00
parent 4618313a82
commit 6e10e97592
300 changed files with 38279 additions and 8584 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1995 David I. Bell
* Copyright (c) 1997 David I. Bell
* Permission is granted to use, distribute, or modify this source,
* provided that this copyright notice remains intact.
*
@@ -19,26 +19,19 @@ define mersenne(p)
return 1;
/* if p is not prime, then 2^p-1 is not prime */
if (! ptest(p,10))
if (! ptest(p,1))
return 0;
/* calculate 2^p-1 for later mods */
p_mask = 2^p - 1;
/* lltest: u(i+1) = u(i)^2 - 2 mod 2^p-1 */
u = 4;
for (i = 2; i < p; ++i) {
u = u^2 - 2;
u = u&p_mask + u>>p;
if (u > p_mask)
u = u&p_mask + 1;
u = hnrmod(u^2 - 2, 1, p, -1);
}
/* 2^p-1 is prime iff u(p) = 0 mod 2^p-1 */
return (u == p_mask);
return (u == 0);
}
global lib_debug;
if (lib_debug >= 0) {
if (config("lib_debug") >= 0) {
print "mersenne(p) defined";
}