Skip to content

Instantly share code, notes, and snippets.

@yornaath
Created March 13, 2011 01:56
Show Gist options
  • Save yornaath/867792 to your computer and use it in GitHub Desktop.
Save yornaath/867792 to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<script type="text/javascript">
/*
var bestCand = [];
var s = "FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth";
var sa = s.toLowerCase().split("");
//console.log(sa);
for(var i = 4; i < sa.length; i++){
var cand = [];
cand.push(sa[i]);
for(var o = 0; o == o; o++){
if(sa[i-o] == sa[i+o]){
cand.unshift(sa[i-o]);
cand.push(sa[i+o]);
if(cand.length > bestCand.length){
bestCand = cand;
}
} else {
break;
}
}
}
console.log((bestCand.join()).replace(",",""));
*/
var f = [0, 1];
var minCheck = 227000;
var pd = 0;
for(var i = 2; i < 40; i++){
f[i] = f[i-1] + f[i-2];
if(f[i] > minCheck & isPrime(f[i])){
alert(countPrimeDivisors(f[i]));
}
}
function countPrimeDivisors(nr){
var pd = 0;
var i = 0;
for(i = nr-1; i >= 2; i--){
if(isPrime(i)){
console.log(i);
pd++;
}
}
return pd;
}
function isPrime(nr){
var isPrime = true;
var d = nr;
for(d = d-1; d>1; d--){
if(nr % d == 0){
isPrime = false;
}
}
return isPrime;
}
console.log(countPrimeDivisors(13));
</script>
<title></title>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment