cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A108852 Number of Fibonacci numbers <= n.

Original entry on oeis.org

1, 3, 4, 5, 5, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11
Offset: 0

Views

Author

Michael C. Vanier (mvanier(AT)cs.caltech.edu), Nov 27 2005

Keywords

Comments

1 is counted twice as a Fibonacci number: F(1) = F(2) = 1. - Alois P. Heinz, Nov 04 2024

Crossrefs

Partial sums of A104162.

Programs

  • Haskell
    fibs :: [Integer]
    fibs = 0 : 1 : zipWith (+) fibs (tail fibs)
    fibs_to :: Integer -> Integer
    fibs_to n = length $ takeWhile (<= n) fibs
    
  • Maple
    a:= proc(n) option remember; `if`(n<2, 2*n+1, a(n-1)+
          (t-> `if`(issqr(t+4) or issqr(t-4), 1, 0))(5*n^2))
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Nov 04 2024
  • Mathematica
    fibPi[n_] := 1 + Floor[ Log[ GoldenRatio, 1 + n*Sqrt@ 5]]; Array[fibPi, 80, 0] (* Robert G. Wilson v, Aug 03 2014 *)
  • Python
    def A108852(n):
        a, b, c = 0, 1, 0
        while a <= n:
            a, b = b, a+b
            c += 1
        return c # Chai Wah Wu, Nov 04 2024

Formula

G.f.: (Sum_{n>=0} x^Fibonacci(n))/(1-x). - Vladeta Jovovic, Nov 27 2005
a(n) = 1+floor(log_phi((sqrt(5)*n+sqrt(5*n^2+4))/2)), n>=0, where phi is the golden ratio. Alternatively, a(n) = 1+floor(arcsinh(sqrt(5)*n/2)/log(phi)). Also a(n) = A072649(n)+2. - Hieronymus Fischer, May 02 2007
a(n) = 1+floor(log_phi(sqrt(5)*n+1)), n>=0, where phi is the golden ratio. - Hieronymus Fischer, Jul 02 2007