Last active
September 30, 2015 12:27
-
-
Save egeozcan/1788749 to your computer and use it in GitHub Desktop.
Revisions
-
egeozcan revised this gist
May 9, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,7 @@ console.log(function () { if (palindromeDivider >= 100) { return [ "our palindrome is ", palindromeDivider, " x ", i, " = ", latestPalindrome ].join(""); } } -
egeozcan revised this gist
May 9, 2015 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,15 @@ console.time("p"); console.log(function () { var x, y, z, i = 999, latestPalindrome = 0, palindromeDivider = 0; for (x = 9; x > 0; x--) { for (y = 9; y >= 0; y--) { for (z = 9; z >= 0; z--) { latestPalindrome = 100001 * x + 10010 * y + 1100 * z; for (i = 999; i >= 100; i--) { if (latestPalindrome % i === 0) { palindromeDivider = latestPalindrome / i if(palindromeDivider > 999)break; if (palindromeDivider >= 100) { return [ "our palindrome is ", latestPalindrome / i, " x ", i, -
egeozcan revised this gist
Nov 28, 2013 . 1 changed file with 14 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,24 +1,22 @@ console.time("p"); console.log(function () { var x, y, z, i = 999, found = false, latestPalindrome = 0; for (x = 9; x > 0; x--) { for (y = 9; y >= 0; y--) { for (z = 9; z >= 0; z--) { latestPalindrome = 100001 * x + 10010 * y + 1100 * z; for (i = 999; i >= 100; i--) { if (latestPalindrome % i === 0) { if ((latestPalindrome / i).toString().length === 3) { return [ "our palindrome is ", latestPalindrome / i, " x ", i, " = ", latestPalindrome ].join(""); } } } } } } }()); console.timeEnd("p"); -
egeozcan revised this gist
Mar 2, 2012 . 1 changed file with 21 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,21 +1,24 @@ var x = 9, y = 9, z = 9; i = 999, found = false, latestPalindrome = 0; console.log(function() { while(x > 0) { y = 9; while(y >= 0) { z = 9; while(z >= 0) { latestPalindrome = parseInt([x,y,z,z,y,x].join("")); for(var i = 999; i >= 100; i--) { if(latestPalindrome % i === 0) { if ((latestPalindrome/i).toString().length === 3) return [ "our palindrome is ", latestPalindrome/i, " x ", i, " = ", latestPalindrome ].join(""); } } z--; } y--; } x--; } }()); -
egeozcan revised this gist
Mar 2, 2012 . 1 changed file with 2 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,13 +8,8 @@ console.log(function() { latestPalindrome = parseInt([x,y,z,z,y,x].join("")); for(var i = 999; i >= 100; i--) { if(latestPalindrome % i === 0) { if ((latestPalindrome/i).toString().length === 3) return ["our palindrome is ", latestPalindrome/i, " x ", i, " = ", latestPalindrome ].join(""); } } z--; -
egeozcan revised this gist
Mar 2, 2012 . 1 changed file with 21 additions and 22 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,27 +1,26 @@ var x = 9, y = 9, z = 9; i = 999, found = false, latestPalindrome = 0; console.log(function() { while(x > 0) { y = 9; while(y >= 0) { z = 9; while(z >= 0) { latestPalindrome = parseInt([x,y,z,z,y,x].join("")); for(var i = 999; i >= 100; i--) { if(latestPalindrome % i === 0) { var res = function(divisionRes) { if (divisionRes.toString().length === 3) { console.log(["our palindrome is ", divisionRes, " x ", i, " = ", latestPalindrome ].join("")); return true; } }(latestPalindrome/i); if(res) return; } } z--; } y--; } x--; } }()); -
egeozcan revised this gist
Feb 10, 2012 . No changes.There are no files selected for viewing
-
egeozcan created this gist
Feb 10, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ var x = 9, y = 9, z = 9; i = 999, found = false, latestPalindrome = 0; while(x > 0) { if(found) break; y = 9; while(y >= 0) { if(found) break; z = 9; while(z >= 0) { if(found) break; latestPalindrome = parseInt([x,y,z,z,y,x].join("")); for(var i = 999; i >= 100; i--) { if(found) break; if(latestPalindrome % i === 0) { (function(divisionRes) { if (divisionRes.toString().length === 3) { console.log(latestPalindrome, divisionRes, i); found = true; } })(latestPalindrome/i); } } z--; } y--; } x--; }