-
Notifications
You must be signed in to change notification settings - Fork 0
/
squares.html
60 lines (52 loc) · 1.73 KB
/
squares.html
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<body>
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head>
<script src="RSA_numbers_factored.js"></script>
<script>
function tableCreate(){
RSA = new RSA();
var body = document.body,
tbl = document.createElement('table');
// tbl.border = '1';
for(r of RSA.factored()){
if (r[2] % 4n == 3n && r[3] % 4n == 3n) continue;
var tr = tbl.insertRow();
var td = tr.insertCell();
var button;
td.appendChild(document.createTextNode('RSA-'+r[0]));
// td.style.border = '1px solid black';
td = tr.insertCell();
if (has_factors(r, [1n,1n])){
var button = document.createElement("input");
button.type = "button";
button.value = "n";
button.onclick = function(){ alert("n "+r[0]); };
td.appendChild(button);
} else {
td.appendChild(document.createTextNode(" "));
}
td = tr.insertCell();
if (r[2] % 4n == 1n){
button = document.createElement("input");
button.type = "button";
button.value = "p";
button.onclick = function(){ alert("p "+r[0]); };
td.appendChild(button);
} else {
td.appendChild(document.createTextNode(" "));
}
td = tr.insertCell();
if (r[3] % 4n == 1n){
button = document.createElement("input");
button.type = "button";
button.value = "q";
button.onclick = function(){ alert("q "+r[0]); };
td.appendChild(button);
} else {
td.appendChild(document.createTextNode(" "));
}
}
body.appendChild(tbl);
}
tableCreate();
</script>
</body>