jueves, 9 de febrero de 2012

Project Euler 29

import java.math.BigInteger;
import java.util.TreeSet;

public class Problem29 {
 public static void main(String[] args) {
  TreeSet<BigInteger> arbol = new TreeSet<BigInteger>();
  int a,b;
  for (a = 2; a <=100; a++) 
   for (b = 2; b <=100; b++) 
    arbol.add(new BigInteger(a+"").pow(b));
  System.out.println(arbol.size());
 }
}

No hay comentarios:

Publicar un comentario