I want to get the 93rd and more Fibonacci numbers in JAVA. In fact, when I try to get Fibonacci numbers as long
, I get at most the 92nd number. Is there any way to reach 93rd and after?
Sample Output
91. number= 4660046610375530309
92. number= 7540113804746346429
93. number= -6246583658587674878
Here is my code:
long s1 = 0;
long s2 = 1;
long current = 0;
for (int i = 0; i < 100; i++) {
current = s1 + s2;
s2 = s1;
s1 = current;
System.out.println((i+1) + ". " + current);
}