| 1 |
|
| 2 |
% For debugging: |
| 3 |
% (LOAD addr2id) |
| 4 |
(OFF RAISE) |
| 5 |
(ON EOLINSTRINGOK) |
| 6 |
(GLOBAL '(Prime PrPrime HalfPrime Composit!* MPFError Arguments |
| 7 |
&*ASKSTRONG &*NEWNUMBER PRIMLIST |
| 8 |
FIRSTPRIMROOT EXPVECT LOGVECT OutFile)) |
| 9 |
%%(SETQ Arguments (GETUNIXARGS)) |
| 10 |
%(SETQ Prime (GETV UNIXARGS* 1)) |
| 11 |
(PROGN |
| 12 |
(SETQ Prime $1) |
| 13 |
(SETQ PrPrime (SUB1 Prime)) |
| 14 |
(SETQ HalfPrime (QUOTIENT Prime 2)) |
| 15 |
%(SETQ Composit!* (GETV UNIXARGS* 2)) |
| 16 |
(SETQ Composit!* $2) |
| 17 |
%(SETQ MPFError!* (GETV UNIXARGS* 3)) |
| 18 |
(SETQ MPFError!* $3) |
| 19 |
% (SETQ PrimeFilePreAmble "/usr/local/matte/bergman/domains/P") |
| 20 |
% (SETQ PrimeFilePreAmble $4) |
| 21 |
(LOAD "$5") |
| 22 |
(DSKIN "$bmdomains/PRL") |
| 23 |
(SETQ PL (PENULTIMA PRIMLIST)) |
| 24 |
(COND ((EQ (DECIDE1 Prime) 'COMPOSITE) |
| 25 |
(EXIT-WITH-STATUS Composite!*))) |
| 26 |
% (SETQ OutFile (APPENDNUMBERTOSTRING Prime PrimeFilePreAmble)) |
| 27 |
(SETQ OutFile "$4") |
| 28 |
|
| 29 |
% Doing the job |
| 30 |
|
| 31 |
(SETQ FIRSTPRIMROOT (FirstPrimitiveRoot)) |
| 32 |
(SETQ EXPVECT (MKVECT (TIMES2 2 Prime))) |
| 33 |
(SETQ LOGVECT (MKVECT (TIMES2 2 Prime))) |
| 34 |
(MakeEXP!&LOGVECTs (TIMES2 2 Prime)) |
| 35 |
|
| 36 |
% For debugging: |
| 37 |
% EXPVECT LOGVECT INTERPBACKTRACE |
| 38 |
|
| 39 |
% Saving the result on OutFile |
| 40 |
|
| 41 |
(WRS (OPEN OutFile 'OUTPUT)) |
| 42 |
(PRIN2 "% Preparation file for modulus calculation, |
| 43 |
% with the prime modulus ") |
| 44 |
(PRINT Prime) |
| 45 |
(PRIN2 "% The exponents and logarithms are calculated |
| 46 |
% with the base ") (PRINT FIRSTPRIMROOT) |
| 47 |
(TERPRI) |
| 48 |
|
| 49 |
|
| 50 |
(WRITEVECTPROG 'EXPVECT (TIMES2 PrPrime 2)) |
| 51 |
(TERPRI) |
| 52 |
(TERPRI) |
| 53 |
|
| 54 |
(WRITEVECTPROG 'LOGVECT (TIMES2 PrPrime 2)) |
| 55 |
(TERPRI) |
| 56 |
|
| 57 |
(CLOSE (WRS NIL)) |
| 58 |
|
| 59 |
(PRIN2 "* Now the file $4 should exist") (TERPRI) |
| 60 |
) |
| 61 |
(EXIT-WITH-STATUS 0) |
| 62 |
%EOP |