Problem 25: What is the first term in the Fibonacci sequence to contain 1000 digits?
import java.math.BigInteger;
import java.util.LinkedList;
class runner
{
public static void main (String[] args) throws java.lang.Exception
{
long time = System.currentTimeMillis();
LinkedList store = new LinkedList();
store.add(new BigInteger("1"));store.add(new BigInteger("1"));
int counter = 2;
do{
BigInteger test = store.removeFirst().add(store.getFirst());
store.add(test);
counter ++;
if(test.toString().length() >= 1000) break;
}while(true);
System.out.println(counter);
System.out.println("time: "+(System.currentTimeMillis() - time));
}
}