fork download
  1. import java.math.BigInteger;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4.  
  5. class Divisao {
  6. public static void main(String[] args) {
  7. List<BigInteger> lista = new ArrayList<>();
  8.  
  9. BigInteger começo = BigInteger.ONE;
  10. BigInteger fim = BigInteger.valueOf(100);
  11. BigInteger n2 = BigInteger.valueOf(2);
  12. BigInteger n3 = BigInteger.valueOf(3);
  13.  
  14. for (BigInteger a = começo; a.compareTo(fim) <= 0; a = a.add(BigInteger.ONE)) {
  15. if (!a.remainder(n2).equals(n0) && !a.remainder(n3).equals(n0)) {
  16. lista.add(a);
  17. }
  18. }
  19. System.out.println(lista);
  20. }
  21. }
Success #stdin #stdout 0.04s 4386816KB
stdin
Standard input is empty
stdout
[1, 5, 7, 11, 13, 17, 19, 23, 25, 29, 31, 35, 37, 41, 43, 47, 49, 53, 55, 59, 61, 65, 67, 71, 73, 77, 79, 83, 85, 89, 91, 95, 97]