/d/pra.html
by webproger on 2020-04-11
<!DOCTYPE html><html><head>
    <title>Prime Array Number</title>
    <meta name='viewport' content='width=device-width,initial-scale=1.0'>
    <script src='/i/j.php'></script>
    <script src='/i/jqz.php'></script>
    <script src='pra.js'></script>
    <style>
        body {
            margin:0px;
            padding:10px;
            font-family:courier new;
        }
        input[type=text] {
            font-size:0.9em;
            width:100px;
            font-family:courier new;
        }
        table {
            margin:0px;
            background-color:silver;
        }
        td {
            background-color:white;
            text-align:center;
            font-size:0.5em;
        }
        td.fm {
            text-align:left;
            font-size:1em;
            padding:15px 3px 3px 3px;
            font-weight:bold;
        }
        td.tl {
            font-size:0.9em;
            padding:3px;
            text-align:left;
        }
        td.pm {
            background-color: gainsboro;
            font-weight:bold;
            text-align:right;
        }
        td.rt {
            font-weight:bold;
            text-align:right;
        }
        td.gr { color: gray; }
        td.ws { background-color: whitesmoke; }
        
        td.pd { background-color: #99ff99; }
        td.pl { background-color: #e6ffe6; }
        td.rd { background-color: #ffe066; }
        td.rl { background-color: #fffae6; }
        td.ed { background-color: #99ffff; }
        td.el { background-color: #e6ffff; }
    </style>
</head><body><center>
<input type='text' id='in' value=''>
<input type='button' value='Prime Array Number'
    onclick="location.href=jif.ui('cu','path')+'?n='+document.getElementById('in').value"
    ><br>
<script>
function dz(n) {
    var s,q,r;
    s = '';
    q = n;
    while(q) {
        r = q%12;
        if(r==10) r = '†';
        if(r==11) r = '‡';
        s = r+s;
        q = Math.floor(q/12);
    }
    return s;
}
    
var n,pn,no,ix,ln,i,j,k,l,s,x,f;
if(jif.qs('cu','n')) n = parseInt(jif.qs('cu','n')); else n = 99;
document.getElementById('in').value = n;

pn = new pra(n);
no = pn.n();
ix = pn.i();
ln = pn.a.length;
document.writeln("<table cellspacing='0'>");

if(ln) {
    document.writeln("<tr><td class='fm'>");
    f = pn.f();
    l = f.length;
    s = '';
    for(i=0; i<l; i++) {
        if(s) s += '×';
        s += f[i][0]+'<sup>'+f[i][1]+'</sup>';
    }
    document.writeln(no+' = '+s);
    document.writeln(' , ');
    s = '';
    for(i=0; i<l; i++) {
        if(s) s += '×';
        s += '('+dz(f[i][0])+'∧'+dz(f[i][1])+')';
    }
    document.writeln(dz(no)+' = '+s);
    document.writeln("</td></tr>");
}

document.writeln("<tr><td colspan='"+(ln+1)+"' class='tl'>");
document.writeln("pn = new pra("+n+");<br>");
if(ln) document.writeln("pn.a :");
else   document.writeln("pn.a : empty");
document.writeln("</td></tr>");

if(ln) {
    document.writeln("<tr><td style='font-size:1em;'>");
    document.writeln("<table cellspacing='1'>");
    document.writeln("<tr><td>&nbsp;&nbsp;</td>");
    
    for(i=0; i<ln; i++) {
        s = i;
        if(s<10) s = '&nbsp;'+s;
        document.writeln("<td style='color:gray;'>"+s+"</td>");
    }
    document.writeln('</tr>');
    document.writeln("<tr><td class='gr'>0</td>");
    for(i=0; i<ln; i++) {
        document.writeln("<td class='pd'>"+pn.a[i][0]+"</td>");
    }
    document.writeln('</tr>');
    document.writeln("<tr><td class='gr'>1</td>");
    for(i=0; i<ln; i++) {
        if(pn.a[i][1]==0) document.writeln("<td class='rd'>"+pn.a[i][1]+"</td>");
        else              document.writeln("<td class='rl'>"+pn.a[i][1]+"</td>");
    }
    document.writeln('</tr>');
    document.writeln('</table>');
    document.writeln("</td></tr>");
}

document.writeln("<tr><td colspan='"+(ln+1)+"' class='tl'>");
document.writeln("pn.n() : "+no+"<br>");
document.writeln("pn.i() : "+ix+"<br>");
f = pn.f();
l = f.length;
if(l) document.writeln("pn.f() :");
else  document.writeln("pn.f() : empty");
document.writeln("</td></tr>");

if(l) {
    document.writeln("<tr><td style='font-size:1em;'>");
    document.writeln("<table cellspacing='1'>");
    document.writeln("<tr><td>&nbsp;&nbsp;</td>");
    for(i=0; i<l; i++) {
        s = i;
        if(s<10) s = '&nbsp;'+s;
        document.writeln("<td style='color:gray;'>"+s+"</td>");
    }
    document.writeln('</tr>');
    document.writeln("<tr><td class='gr'>0</td>");
    for(i=0; i<l; i++) {
        document.writeln("<td class='pd'>"+f[i][0]+"</td>");
    }
    document.writeln('</tr>');
    document.writeln("<tr><td class='gr'>1</td>");
    for(i=0; i<l; i++) {
        document.writeln("<td class='ed'>"+f[i][1]+"</td>");
    }
    document.writeln('</tr>');
    document.writeln('</table>');
    document.writeln("</td></tr>");
}

document.writeln('</table>');
</script>
<br>
<script src='pra_remainder.js'></script>
<br>
<script src='pra_exponent.js'></script>
<br>
<script src='pra_Goldbach.js'></script>
</center></body></html>