Esempio n. 1
0
 def test_nth_digit_Fibonacci_number_4(self):
     self.assertEqual(next_fibonacci_number(10 ** (4 - 1)), (17, 1597))
Esempio n. 2
0
 def test_nth_digit_Fibonacci_number_2(self):
     self.assertEqual(next_fibonacci_number(10 ** (2 - 1)), (7, 13))
Esempio n. 3
0
 def test_nth_digit_Fibonacci_number_3(self):
     self.assertEqual(next_fibonacci_number(10 ** (3 - 1)), (12, 144))
Esempio n. 4
0
The 12th term, F_12, is the first term to contain three digits.

What is the first term in the Fibonacci sequence to contain 1000 digits?
'''
import unittest
from problems.utils import next_fibonacci_number


# =============================================================================
# Unit tests
# -----------------------------------------------------------------------------


class Test(unittest.TestCase):

    def test_nth_digit_Fibonacci_number_2(self):
        self.assertEqual(next_fibonacci_number(10 ** (2 - 1)), (7, 13))

    def test_nth_digit_Fibonacci_number_3(self):
        self.assertEqual(next_fibonacci_number(10 ** (3 - 1)), (12, 144))

    def test_nth_digit_Fibonacci_number_4(self):
        self.assertEqual(next_fibonacci_number(10 ** (4 - 1)), (17, 1597))

# =============================================================================
# Solution of the Euler task
# -----------------------------------------------------------------------------


print(next_fibonacci_number(10 ** (1000 - 1)))