blob: 96025d3ff763cbbe3d4302f4cbbbbbc8337faf45 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
implement Genfield;
include "sys.m";
sys: Sys;
include "draw.m";
include "keyring.m";
kr: Keyring;
IPint: import kr;
Genfield: module
{
init: fn(nil: ref Draw->Context, nil: list of string);
};
Field: con 65537;
init(nil: ref Draw->Context, args: list of string)
{
sys = load Sys Sys->PATH;
kr = load Keyring Keyring->PATH;
f := IPint.inttoip(Field);
fm2 := f.sub(IPint.inttoip(2));
for(i := 1; i <= Field; i++){
x := IPint.inttoip(i);
y := x.expmod(fm2, f);
# sys->print("%s\n", x.mul(y).expmod(IPint.inttoip(1), f).iptostr(10));
sys->print("%d,\n", y.iptoint());
}
}
|