Skip to content

Instantly share code, notes, and snippets.

@LuxXx
Created April 17, 2017 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LuxXx/2c25ad758b904b4323cf4be66762625b to your computer and use it in GitHub Desktop.
Save LuxXx/2c25ad758b904b4323cf4be66762625b to your computer and use it in GitHub Desktop.
Project Euler - Problem 48
package euler;
import java.math.BigInteger;
public class SelfPowers {
public static void main(String[] args) {
BigInteger sum = BigInteger.ZERO;
for (int i = 1; i <= 1000; i++) {
sum = sum.add(BigInteger.valueOf(i).pow(i));
}
System.out.println(sum.toString().substring(sum.toString().length() - 10, sum.toString().length()));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment