Created
December 9, 2014 10:51
-
-
Save birkir/fbca1b273e8e4c219860 to your computer and use it in GitHub Desktop.
Jóladagatal 9/24 - Skrítnar tölur
This file contains 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 characters
81 | |
2.025 | |
3.025 | |
9.801 | |
494.209 | |
998.001 | |
24.502.500 | |
25.502.500 | |
52.881.984 | |
60.481.729 | |
99.980.001 |
This file contains 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 characters
var i = 0; | |
while (true) { | |
// only numbers in length of mod 2 | |
if ((i+'').length % 2 !== 0) i *= 10; | |
// get first and last part of number | |
var a = (i+''), | |
b = parseInt(a.substr(0, a.length / 2), 0), | |
c = parseInt(a.substr(a.length / 2), 0); | |
// print number if the parts sum with power of two is equal to number | |
if (i === Math.pow(b + c, 2)) console.log(i); | |
// iterate | |
i++; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment