diff --git a/C#/25.1000 FIBONACCI NUMBER/RudaniNishant.CS b/C#/25.1000 FIBONACCI NUMBER/RudaniNishant.CS new file mode 100644 index 0000000..b8bcdab --- /dev/null +++ b/C#/25.1000 FIBONACCI NUMBER/RudaniNishant.CS @@ -0,0 +1,14 @@ +// Project Euler Problem No 25 +int i = 0; +int cnt = 2; +BigInteger limit = BigInteger.Pow(10, 999); +BigInteger[] fib = new BigInteger[3]; + +fib[0] = 1; +fib[2] = 1; + +while (fib[i] <= limit) { + i = (i + 1) % 3; + cnt++; + fib[i] = fib[(i + 1) % 3] + fib[(i + 2) % 3]; +} diff --git a/README.md b/README.md index b794d72..71d5d3a 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Happy Contributing! 😃 | 22 | [Names scores](https://projecteuler.net/problem=22) | | | | :white_check_mark: | | | | | | | | | | 23 | [Non-abundant sums](https://projecteuler.net/problem=23) | | | | | | | | | | | | | | 24 | [Lexicographic permutations](https://projecteuler.net/problem=24) | | | | | | | | | | | | | -| 25 | [1000-digit Fibonacci number](https://projecteuler.net/problem=25) | | | | :white_check_mark: | | | | | | | | | +| 25 | [1000-digit Fibonacci number](https://projecteuler.net/problem=25) | | | | :white_check_mark: | | | | :white_check_mark: | | | | | | 26 | [Reciprocal cycles](https://projecteuler.net/problem=26) | | | | | | | | | | | | | | 27 | [Quadratic primes](https://projecteuler.net/problem=27) | | :white_check_mark: | | | | | | | | | | | | 28 | [Number spiral diagonals](https://projecteuler.net/problem=28) | :white_check_mark: | :white_check_mark: | | :white_check_mark: | | | :white_check_mark: | | | | | |