Skip to content

Commit c03efe1

Browse files
Gonzalo DiazGonzalo Diaz
Gonzalo Diaz
authored and
Gonzalo Diaz
committed
First baby-steps with problem 0063
1 parent 1fc35ec commit c03efe1

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

problem0063.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
let exp = 0;
2+
let base = 0;
3+
let total = 0;
4+
let iPotencia;
5+
let lPotencia;
6+
let partial = 0;
7+
8+
do {
9+
base = 0;
10+
partial = 0;
11+
exp++;
12+
13+
do {
14+
15+
iPotencia = Math.pow(base, exp);
16+
lPotencia = Math.log(iPotencia) * Math.LOG10E + 1 | 0;
17+
18+
if (lPotencia === exp) {
19+
console.log(`${base} ^ ${exp} = ${iPotencia} => ${lPotencia}`)
20+
total++;
21+
partial++;
22+
}
23+
24+
base++;
25+
} while (exp >= lPotencia)
26+
27+
console.log(`exp ${exp} => PARTIAL = ${partial}`)
28+
29+
} while (partial > 0 && exp < 2)
30+
31+
console.log(`TOTAL: ${total}`)

0 commit comments

Comments
 (0)