<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                ## 問題 你想計算一個數字N的斐波那契序列,但是希望計算更加效率快捷。 ## 方法 以下的解決方案(仍有待提高)來源于羅賓休斯(Robin Houston)的博客中。 這里有一些鏈接討論關于改進的算法和方法: * [http://bosker.wordpress.com/2011/04/29/the-worst-algorithm-in-the-world/](http://bosker.wordpress.com/2011/04/29/the-worst-algorithm-in-the-world/) * [http://www.math.rutgers.edu/~erowland/fibonacci](http://www.math.rutgers.edu/~erowland/fibonacci.html) * [http://jsfromhell.com/classes/bignumber](http://jsfromhell.com/classes/bignumber) * [http://www.math.rutgers.edu/~erowland/fibonacci](http://www.math.rutgers.edu/~erowland/fibonacci.html) * [http://bigintegers.blogspot.com/2010/11/square-division-power-square-root](http://bigintegers.blogspot.com/2010/11/square-division-power-square-root.html) * [http://bugs.python.org/issue3451](http://bugs.python.org/issue3451) 代碼來源于gist:?[https://gist.github.com/1032685](https://gist.github.com/1032685) ~~~ ### Author: Jason Giedymin <jasong _a_t_ apache -dot- org> http://www.jasongiedymin.com https://github.com/JasonGiedymin CoffeeScript編譯的JavaScript實現的快速菲波那契算法是基于Robin Houston的博客中的python代碼。 參看上面的鏈接 A few things I want to introduce in time are implementions of Newtonian, Burnikel / Ziegler, and Binet's algorithms on top of a Big Number framework. 我想給大家及時講解一些Newtonian, Burnikel / Ziegler和 Binet 在 Big Number框架上的具體實現。 Todo: - https://github.com/substack/node-bigint - BZ and Newton mods. - Timing ### MAXIMUM_JS_FIB_N = 1476 fib_bits = (n) -> #Represent an integer as an array of binary digits. bits = [] while n > 0 [n, bit] = divmodBasic n, 2 bits.push bit bits.reverse() return bits fibFast = (n) -> #Fast Fibonacci if n < 0 console.log "Choose an number >= 0" return [a, b, c] = [1, 0, 1] for bit in fib_bits n if bit [a, b] = [(a+c)*b, b*b + c*c] else [a, b] = [a*a + b*b, (a+c)*b] c = a + b return b divmodNewton = (x, y) -> throw new Error "Method not yet implemented yet." divmodBZ = () -> throw new Error "Method not yet implemented yet." divmodBasic = (x, y) -> ### Absolutely nothing special here. Maybe later versions will be Newtonian or Burnikel / Ziegler _if_ possible... ### return [(q = Math.floor x/y), (r = if x < y then x else x % y)] start = (new Date).getTime(); calc_value = fibFast(MAXIMUM_JS_FIB_N) diff = (new Date).getTime() - start; console.log "[#{calc_value}] took #{diff} ms." ~~~ ## 討論 還有問題嗎?
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看