Preview

A Fast Algorithm for Computing Large Fibonacci Numbers

Better Essays
Open Document
Open Document
1847 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
A Fast Algorithm for Computing Large Fibonacci Numbers
Information Processing Letters 75 (2000) 243–246

A fast algorithm for computing large Fibonacci numbers
Daisuke Takahashi
Department of Information and Computer Sciences, Saitama University, 255 Shimo-Okubo, Urawa-shi, Saitama 338-8570, Japan Received 13 March 2000; received in revised form 19 June 2000 Communicated by K. Iwama

Abstract We present a fast algorithm for computing large Fibonacci numbers. It is known that the product of Lucas numbers algorithm uses the fewest bit operations to compute the Fibonacci number Fn . We show that the number of bit operations in the conventional product of Lucas numbers algorithm can be reduced by replacing multiplication with the square operation. © 2000 Elsevier Science B.V. All rights reserved.
Keywords: Program derivation; Fibonacci numbers

1. Introduction

1.1. Fibonacci and Lucas numbers We define the Fibonacci numbers as F0 = 0, F1 = 1, n 0. (1)

Many algorithms for computing Fibonacci numbers have been well studied [11,12,5,8,4,3,7,9,2]. It is known that the product of Lucas numbers algorithm uses the fewest bit operations to compute Fn [2]. In this paper, we present a fast algorithm for computing large Fibonacci numbers. This algorithm is based on the product of Lucas numbers algorithm [9, 2]. The conventional product of Lucas numbers algorithm uses multiplication and square operation. In general, it is known that the number of bit operations used to square an n-bit number is less than that used to multiply two n-bit numbers. Thus, the number of bit operations in the conventional product of Lucas numbers algorithm can be reduced by replacing multiplication with the square operation.

Fn+2 = Fn+1 + Fn ,

The Lucas numbers are defined as L0 = 2, L1 = 1, n 0. (2)

Ln+2 = Ln+1 + Ln ,

We also have the formulas αn − β n , α−β Ln = α n + β n , Fn = (3)

E-mail address: daisuke@ics.saitama-u.ac.jp (D. Takahashi).

(4) √ √ where α = (1 + 5)/2 and β = (1 − 5)/2. We will use γ n to represent the



References: [1] J.W. Cooley, J.W. Tukey, An algorithm for the machine calculation of complex Fourier series, Math. Comput. 19 (1965) 297–301. [2] P. Cull, J.L. Holloway, Computing Fibonacci numbers quickly, Inform. Process. Lett. 32 (1989) 143–149. [3] M.C. Er, Computing sums of order-k Fibonacci numbers in log time, Inform. Process. Lett. 17 (1983) 1–5. [4] M.C. Er, A fast algorithm for computing order-k Fibonacci numbers, Comput. J. 26 (1983) 224–227. [5] D. Gries, G. Levin, Computing Fibonacci numbers (and similarly defined functions) in log time, Inform. Process. Lett. 11 (1980) 68–69. [6] D.E. Knuth, The Art of Computer Programming, Vol. 2: Seminumerical Algorithms, Addison-Wesley, Reading, MA, 1997. [7] A.J. Martin, M. Rem, A presentation of the Fibonacci algorithm, Inform. Process. Lett. 19 (1984) 67–68. [8] A. Pettorossi, Derivation of an O(k 2 log n) algorithm for computing order-k Fibonacci numbers from the O(k 3 log n) matrix multiplication method, Inform. Process. Lett. 11 (1980) 172–179. [9] M. Protasi, M. Talamo, On the number of arithmetical operations for finding Fibonacci numbers, Theoret. Comput. Sci. 64 (1989) 119–124. [10] A. Schönhage, V. Strassen, Schnelle Multiplikation grosser Zahlen, Computing (Arch. Elektron. Rechnen) 7 (1971) 281– 292. [11] J. Shortt, An iterative program to calculate Fibonacci numbers in O(log n) arithmetic operations, Inform. Process. Lett. 7 (1978) 299–303. [12] F.J. Urbanek, An O(log n) algorithm for computing the nth element of the solution of a difference equation, Inform. Process. Lett. 11 (1980) 66–67.

You May Also Find These Documents Helpful

  • Satisfactory Essays

    (c) Convert the following numbers into binary and perform the arithmetic operations in (i) and (ii) using signed binary numbers with 2’s complement. Use 7 bits to represent the integer part of decimal numbers and the sign bit. Use three bits to represent the fractional part.…

    • 780 Words
    • 10 Pages
    Satisfactory Essays
  • Better Essays

    Mat 126 Week 1 Assignment

    • 1084 Words
    • 5 Pages

    1 + 2 = 3; 3 + 2 = 5; 5 + 2 = 7; 7 + 2 = 9; ……

    • 1084 Words
    • 5 Pages
    Better Essays
  • Satisfactory Essays

    *; import java.math. BigDecimal; import java.util. *; /** * * @author: Huma UmmulBanin Zaidi * @Project:Project1, Data Structure.…

    • 779 Words
    • 4 Pages
    Satisfactory Essays
  • Satisfactory Essays

    hiihihi

    • 10962 Words
    • 41 Pages

    b. Divide a polynomial expression by a binomial expression of the form x − a, a∈ I , using long division or synthetic division.…

    • 10962 Words
    • 41 Pages
    Satisfactory Essays
  • Powerful Essays

    Exam on Algorithms

    • 1238 Words
    • 5 Pages

    The following algorithm is to be applied to the positive integers from 1 to 12.…

    • 1238 Words
    • 5 Pages
    Powerful Essays
  • Good Essays

    The most interesting thing I learned while researching Leonardo Bonacci was discovering that Fibonacci numbers are in nature. It says the numbers represent flower petals on types of flowers. A source also says the sequence can be found on plants, petals, fruits, the human face, the human hand, and animals. The sequence outline is found on living things that are growing. Another fact about Fibonacci is that he created the sequence in a discussion about breeding…

    • 618 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    1. Calculate the value of “n”. Show your work. Include an example of ALL calculations involving solving for “n”.…

    • 723 Words
    • 3 Pages
    Powerful Essays
  • Good Essays

    Liber Abaci is a book that Leonardo Fibonacci wrote in 1202. In it Fibonacci introduces the so-called modus Indorum (method of the Indians), today known as the Arabic numerals. It shows the practical importance of the new numeral system, using lattice multiplication and Egyptian fractions, by applying it to commercial bookkeeping, conversion of weights and measures, the calculation of interest, money-changing, and other applications. Liber Abaci also posed, and solved, a problem involving the growth of a hypothetical population of rabbits based on idealized assumptions. The solution, generation by generation, was a sequence of numbers later known as the Fibonacci numbers. In the Fibonacci sequence of numbers, each number after the first two, is the sum of the previous two numbers. The sequence is 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, etc. The higher the sequence, the closer two consecutive numbers of the sequence divided by each other will approach the golden ratio ( approximately 1 : 1. 618 or 0.618 : 1).…

    • 364 Words
    • 2 Pages
    Good Essays
  • Better Essays

    Ib Math Sl Type Ii Ia

    • 1192 Words
    • 5 Pages

    This formula uses “n” as the row number and the outcome is the numerator of the requested sixth row.…

    • 1192 Words
    • 5 Pages
    Better Essays
  • Powerful Essays

    The Fibonacci sequence is a system of numbers that equate to the two preceding numbers. In terms of music it is difficult to define how this might fit into a musical sequence; in form it makes a bit more sense when associating the golden ratio. However, there is a means to obtain a musical sequence using Fibonacci’s sequence. If we consider that there are seven main tones (excluding sharps or flats) in a general scale, before any note is repeated, we are able to find a number to create an equation that relates to the Fibonacci sequence, namely 7. If we then take the first few numbers of the…

    • 1400 Words
    • 6 Pages
    Powerful Essays
  • Good Essays

    Fibonacci Numbers

    • 717 Words
    • 3 Pages

    The Fibonacci sequence has a plethora of applications in art and in nature. One frequent finding in nature involves the use of an even more powerful result of the Fibonacci sequence: phi and the golden ratio. The following is an example of what I will later discuss: the golden spiral.…

    • 717 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    Midterm Statistics

    • 1384 Words
    • 15 Pages

    form (on pages 7 and 8); only the answers, no derivations. (For this midterm, only…

    • 1384 Words
    • 15 Pages
    Powerful Essays
  • Good Essays

    Fibonacci Sequence

    • 462 Words
    • 2 Pages

    Fibonacci, also known as the Leonardo of Pisa, born in the early 1770’s AD in Pisa, Italy, has had a huge impact on today’s math, and is used in everyday jobs all over the world. After living with his dad, a North African educator, he discovered these ways of math by traveling along the Mediterranean Coast learning their ways of math. With the inspiration from the “Hindu-Arabic” numerical system, Fibonacci created the 0-9 number system we still use to this day.…

    • 462 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    Q Basic

    • 627 Words
    • 3 Pages

    1) WAP to print the Fibonacci series CLS a = 1 b = 1 PRINT a, b, FOR i = 1 TO 8 c = a + b PRINT c, a = b b = c NEXT i END ………………………………………………………………………………. 2) WAP to print the factors of a given number REM Program to print the factors of a given number CLS INPUT “Enter any number”; n FOR i = 1 TO n IF n MOD i = 0 THEN PRINT i, NEXT i END ………………………………

    • 627 Words
    • 3 Pages
    Satisfactory Essays
  • Better Essays

    Nuclear Weapons

    • 1103 Words
    • 5 Pages

    Functional programming Ex. C++. #include <iostream> // Fibonacci numbers, imperative style int fibonacci(int iterations) { int first = 0, second = 1; // seed values for (int i = 0; i < iterations; ++i) { int sum = first + second; first = second; second = sum; } return first; } int main() { std::cout << fibonacci(10) << "\n"; return 0; } A functional version (in Haskell) has a different feel to it: -- Fibonacci numbers, functional style -- describe an infinite list based on the recurrence relation for Fibonacci numbers…

    • 1103 Words
    • 5 Pages
    Better Essays