Updated the solutions for "Puzzled Programmers" puzzle #5
This commit is contained in:
parent
fa222eb627
commit
22ad79e961
2 changed files with 2 additions and 4 deletions
File diff suppressed because one or more lines are too long
|
|
@ -59,13 +59,11 @@ function run() {
|
|||
p[d] = Math.pow(d, power);
|
||||
}
|
||||
let n = start;
|
||||
let m = (n / 10)|0;
|
||||
while (true) {
|
||||
let sum = sumPowers(m);
|
||||
let sum = sumPowers(n);
|
||||
for (let d = 0; d <= 9; d++) {
|
||||
if (sum + p[d] == n + d) console.log(n + d);
|
||||
}
|
||||
m += 1;
|
||||
n += 10;
|
||||
if (n >= end) break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue