Keen eyes
jonas.thornvall at gmail.com
jonas.thornvall at gmail.com
Sat Jan 16 17:23:23 EST 2016
This is not python just a short snippet of javascript that refuse tracing, i've staired blind upon it but since it does something weird with allocating memory i have no idea what is going on and the parrots and monkeys at comp.lang.javascript refuse to give a hint.
Something in those loops really wrong but it is no giant numbers.
<script language="Javascript">
function factor_it(i){
prime=true;
sqroot=Math.floor(Math.sqrt(i));
for (j=2;j<sqroot;j++){ k=i/j; prime=!Number.isInteger(k); if (prime) {return prime}}
return prime;
}
function main(){
base=10;
outStr="";
//while (base==10) {
j=1;
while(j<base){
document.prime.trash.value =" J ="+j+",";
prime=false;
i=j;
i=i+base;
while (i<100){
primeleg=factor_it(i);
if(primeleg==true){break;}
i=i+base;
}
outStr+="Base="+base+" counterval i = "+i+" P primeleg ="+primeleg+"\n";
j++;
}
//base++;
//}
document.prime.out.value =outStr;
}
</script>
<!DOCTYPE html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body onload="main()" bgcolor="gold">
<form name="prime" action="" onsubmit="MAIN(); return false;">
<textarea name="out" cols=80 rows=80></textarea>
<textarea name="trash" cols=80 rows=80></textarea>
</form>
</body>
</html>
More information about the Python-list
mailing list