FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ProjectEuler-Java/Sol29.java at master · JoshP/ProjectEuler-Java · GitHub
JoshP
ProjectEuler-Java
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
ProjectEuler-Java
/
Sol29.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
17 lines (15 loc) · 544 Bytes
Breadcrumbs
ProjectEuler-Java
/
Sol29.java
Copy path
File metadata and controls
17 lines (15 loc) · 544 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import
java
.
util
.*;
import
java
.
math
.*;
// How many distinct terms are in the sequence generated by ab for 2 a 100 and 2 b 100?
public
class
Sol29
extends
BaseSolution
{
public
void
runSolution
() {
Set
<
BigInteger
>
termSet
=
new
HashSet
<
BigInteger
>();
for
(
int
a
=
2
;
a
<=
100
;
a
++) {
for
(
int
b
=
2
;
b
<=
100
;
b
++) {
BigInteger
term
=
new
BigInteger
(
String
.
valueOf
(
a
)).
pow
(
b
);
termSet
.
add
(
term
);
}
}
System
.
out
.
println
(
termSet
.
size
());
}
}
Back
|
FazBrowse Home
|
New Git URL