Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
It's been pointed out that I didn't need to write the extension method RaiseToThePowerOf. BigInt has it's own static Pow method. I blame code blindness.
So, with this in place Problem 25 is solved like this...
1: var ten = BigInt.FromInt32(10);
2: var nineninenine = BigInt.FromInt32(999);
3: var first1000DigitNumber = BigInt.Pow(ten, nineninenine);
4:
5: var answer = new Fibonacci().BigSequence
6: .TakeWhile(x => x < first1000DigitNumber)
7: .Count() + 1;
8:
9: return answer;
... which is a bit better. Thanks bistok.
Comments
Anonymous
March 31, 2009
UPDATE: It's been pointed out that the extension method RaiseToThePowerOf isn't required. I've updatedAnonymous
April 04, 2009
The comment has been removed