Guest User

Untitled

a guest
Apr 25th, 2018
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class xplusnthing{
  4. public static void main(String[] args){
  5. int iMax = 100;
  6. for(int i = 0; i<iMax; i++){
  7. for(int j = 0; j<i; j++){
  8. int a = i-j;
  9. int b = i+j;
  10. int c = a*b;
  11. int d = (int) Math.floor(Math.sqrt(c));
  12. int e = c-(d*d);
  13. int f = (2*d) + 1 - e;
  14. int n = i - d;
  15. int x = d - a;
  16. int nminusone = n - 1;
  17. int xplusn = x + n;
  18. if(xplusn == 11){
  19. System.out.println("{" + e + "," + n + "," + d + "," + x + "," + a + "," + b + "}\t(x+n): " + xplusn + "\tf = " + f + "\td = " + d + "\tn-1 = " + nminusone);
  20. }
  21. }
  22. }
  23. }
  24.  
  25. public static boolean isPrime(int n) {
  26. if (n == 1 || n == 4 || n < 1) {
  27. return false;
  28. }
  29. for (int i = 2; i < (n/2); i++) {
  30. if (n % i == 0) {
  31. return false;
  32. }
  33. }
  34. return true;
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment