Created
April 17, 2017 21:03
-
-
Save LuxXx/2c25ad758b904b4323cf4be66762625b to your computer and use it in GitHub Desktop.
Project Euler - Problem 48
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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