Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Tupel2
- {
- public static String tupelfinden(double maxgrenze)
- {
- double a;
- double b;
- double c;
- double cSumme =0;
- double bmin;
- double bmax;
- double aDifferenz;
- String ergebnis ="";
- bmax = Math.ceil(Math.cbrt(maxgrenze*maxgrenze));
- for(b = 1; b <= bmax ;b++)
- {
- a =1;
- do
- {
- cSumme = a*a*a +b*b*b;
- c = Math.sqrt(cSumme);
- a++;
- if(c == (long)c && c*c <=maxgrenze*maxgrenze)
- {
- ergebnis = "\n\t( " + (a-1) + "," + b + "," + c + " )\n";
- System.out.println("(" + (a-1) + ", " + b + ", " + c + ")");
- }
- }while(a<=b);
- }
- return(ergebnis);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement