~/talk

Fibonacci Funhouse

Talkat Friendly.rb 2024 · 2024-09-18..09-19· [ruby]
speakerdeck:doliveirakn
slides:none on file

Starts with the exponential recursive method (gets useless near n≈30) then implements Binet with BigDecimal (works to ~350 before float/precision slows it), switches to rationals (correct to ~5,994), enables tail-call optimization to reach hundreds of thousands, uses matrix exponentiation by squaring to hit millions, and finally implements fast‑doubling plus memoization (Hash default_proc) to compute the billionth Fibonacci in ~10s producing ~28 million digits — claims Ruby matches C on that machine.

AI-written summary · about

  1. 0:00Introduction to Fibonacci Funhouse
  2. 2:53What are Fibonacci numbers
  3. 4:15Basic recursive algorithm
  4. 5:37Performance issues with recursion
  5. 5:57Binet's formula and constants
  6. 7:21Problems with Binet's formula
  7. 8:46BigDecimal for precision
  8. 10:30Rational numbers approach
  9. 13:42Iterative recursive method
  10. 15:29Tail call optimization
  11. 18:22Matrix multiplication method
  12. 21:35Repeated squares algorithm
  13. 24:45Bitwise operations in Ruby
  14. 25:49Fast doubling algorithm
  15. 28:39Dynamic programming with hashes
  16. 29:43Conclusion and Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.