A
aporia
Gast
Ich probiere grade ein Program aus einem Skript aus, das nach der bewiesenen Vermutung von Fermat eigentlich nicht terminieren dürfte. Was stimmt da nicht an derm Code? Sieht jemand den Fehler?
Code:
public class Fermat {
public static void main(String[] args) {
int max=3;
boolean ewig= true;
while(ewig){
for(int k=3;k<=max;k++)
for(int x=2;x<=max;x++)
for(int y=2;y<=max;y++)
for(int z=2;z<=max;z++)
if((Math.pow(x, k)+Math.pow(y, k))==Math.pow(z, k))
{
System.out.println(Math.pow(z, k));
ewig=false;
}
max++;
}
System.out.println("Alarm!");
}
}