Skip to content

Commit

Permalink
Problem 29
Browse files Browse the repository at this point in the history
  • Loading branch information
plagov committed Jan 23, 2024
1 parent a7a2a49 commit 9348872
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package net.projecteuler.problems.problems026to050;

import java.math.BigInteger;
import java.util.HashSet;

public class Problem029 {

public int solve() {
var result = new HashSet<BigInteger>();

var min = 2;
var max = 100;

for (var a = min; a <= max; a++) {
var base = BigInteger.valueOf(a);
for (var b = min; b <= max; b++) {
var pow = base.pow(b);
result.add(pow);
}
}

return result.size();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package net.projecteuler.problems.problems026to050;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

class Problem029Test {

@Test
void solve() {
assertEquals(9183, new Problem029().solve());
}
}

0 comments on commit 9348872

Please sign in to comment.