FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ProjectEuler-Java/Sol25.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
/
Sol25.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
20 lines (17 loc) · 554 Bytes
Breadcrumbs
ProjectEuler-Java
/
Sol25.java
Copy path
File metadata and controls
20 lines (17 loc) · 554 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
18
19
20
import
java
.
util
.*;
import
java
.
math
.*;
public
class
Sol25
extends
BaseSolution
{
public
void
runSolution
() {
BigInteger
prev1
=
BigInteger
.
ZERO
;
BigInteger
prev2
=
BigInteger
.
ONE
;
BigInteger
savePrev1
=
BigInteger
.
ZERO
;
int
n
=
0
;
do
{
n
++;
savePrev1
=
prev1
;
prev1
=
prev2
;
prev2
=
savePrev1
.
add
(
prev2
);
}
while
(
prev1
.
toString
().
length
() <
1000
);
System
.
out
.
println
(
"n = "
+
n
+
" fib = "
+
prev1
.
toString
());
}
}
Back
|
FazBrowse Home
|
New Git URL