Why did I make this?

No description

main.js
```1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
```
```//https://peterjamesthomas.com/2017/03/10/solve-if-u-r-a-genius/
//Guess what z is:
var z={r:0,i:0};

//Complex functions
return{r:a.r+b.r,i:a.i+b.i};
}
function divide(a,b){
return{
r:((a.r*b.r)+(a.i*b.i))/(Math.pow(b.r,2)+Math.pow(b.i,2)),
i:((a.i*b.r)-(a.r*b.i))/(Math.pow(b.r,2)+Math.pow(b.i,2))
};
}
function polar(distance,angle){distance=Math.abs(distance);return{r:distance*Math.cos(angle),i:distance*Math.sin(angle)};}
function power(b,e){
//hypot(a,b)=>Math.sqrt(a*a+b*b);
var distance=Math.sqrt(b.r*b.r+b.i*b.i),angle=Math.atan2(b.i,b.r);
return polar(
Math.pow(distance,e.r)*Math.exp(-e.i*angle),
e.i*Math.log(distance)+e.r*angle
);
}
//Test
var infinity=1000,sum={r:0,i:0}; //Make sure infinity is big enough and computable.
for(var n=1;n<=infinity;n++){
}
console.log("The total is "+JSON.stringify(sum)+".");
if(sum.r==0&&sum.i==0){
var solved=true;
for(var a=1;a<=infinity;a++){
if(z.r==-2*a&&z.i==0){
console.log("-2*"+a+"="+(-2*a)+"=Re(z)");solved=false;break;
}
}
if(solved){
console.log("You've solved it! z is "+JSON.stringify(z)+".");
}
}```
Native Browser JavaScript