fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. d();
  13. }
  14.  
  15. static void d() {
  16. final List<Long> t = new ArrayList();
  17. for (int i = 2, j; i < 25; i++) {
  18. for (j = 2; j < 25; j++) {
  19. final long s = (long) (Math.pow(i, j) + Math.pow(j, i));
  20. if ((s < (1L << 31)) & !t.contains(s)) {
  21. t.add(s);
  22. }
  23. }
  24. }
  25. Collections.sort(t);
  26. for(long l:t){
  27. System.out.print(l+" ");
  28. }
  29. }
  30. }
Success #stdin #stdout 0.11s 320512KB
stdin
Standard input is empty
stdout
8 17 32 54 57 100 145 177 320 368 512 593 945 1124 1649 2169 2530 4240 5392 6250 7073 8361 16580 18785 20412 23401 32993 60049 65792 69632 93312 94932 131361 178478 262468 268705 397585 423393 524649 533169 1048976 1058576 1596520 1647086 1941760 2012174 2097593 4194788 4208945 4785713 7861953 8389137 9865625 10609137 14352282 16777792 16797952 33554432 43050817 45136576 48989176 61466176 67137425 129145076 177264449 244389457 268473872 292475249 364568617 387426321 774840978 1073792449 1162268326 1173741824 1221074418 1996813914