Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #59 Aug 09 2024 05:06:48
%S 1,2,3,3,5,5,5,8,8,8,8,8,13,13,13,13,13,13,13,13,21,21,21,21,21,21,21,
%T 21,21,21,21,21,21,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,
%U 34,34,34,34,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55
%N Greatest Fibonacci number that does not exceed n.
%C Also the largest term in Zeckendorf representation of n; starting at Fibonacci positions the sequence is repeated again and again in A107017: A107017(A000045(n)+k) = a(k) with 0 < k < A000045(n-1). - _Reinhard Zumkeller_, May 09 2005
%C Fibonacci(n) occurs Fibonacci(n-1) times, for n >= 2. - _Benoit Cloitre_, Dec 15 2022
%H Reinhard Zumkeller, <a href="/A087172/b087172.txt">Table of n, a(n) for n = 1..10000</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/FibonacciNumber.html">Fibonacci Number</a>.
%F a(n) = Fibonacci(A130233(n)) = Fibonacci(A130234(n+1)-1). - _Hieronymus Fischer_, May 28 2007
%F a(n) = A035516(n, 0) = A035517(n, A007895(n)-1). - _Reinhard Zumkeller_, Mar 10 2013
%F a(n) = n - A066628(n). - _Michel Marcus_, Feb 02 2016
%F Sum_{n>=1} 1/a(n)^2 = Sum_{n>=1} Fibonacci(n)/Fibonacci(n+1)^2 = 1.7947486789... . - _Amiram Eldar_, Aug 16 2022
%p with(combinat):
%p A087172 := proc (n) local j: for j while fibonacci(j) <= n do fibonacci(j) end do: fibonacci(j-1) end proc:
%p seq(A087172(n), n = 1 .. 40); # _Emeric Deutsch_, Nov 11 2014
%p # Alternative
%p N:= 100: # to get a(n) for n from 1 to N
%p Fibs:= [seq(combinat:-fibonacci(i), i = 1 .. ceil(log[(1 + sqrt(5))/2](sqrt(5)*N)))]:
%p A:= Vector(N):
%p for i from 1 to nops(Fibs)-1 do
%p A[Fibs[i] .. min(N,Fibs[i+1]-1)]:= Fibs[i]
%p od:
%p convert(A,list); # _Robert Israel_, Nov 11 2014
%t With[{rf=Reverse[Fibonacci[Range[10]]]},Flatten[Table[ Select[ rf,n>=#&, 1],{n,80}]]] (* _Harvey P. Dale_, Dec 08 2012 *)
%t Flatten[Map[ConstantArray[Fibonacci[#],Fibonacci[#-1]]&,Range[15]]] (* _Peter J. C. Moses_, May 02 2022 *)
%o (PARI) a(n)=my(k=log(n)\log((1+sqrt(5))/2)); while(fibonacci(k)<=n, k++); fibonacci(k--) \\ _Charles R Greathouse IV_, Jul 24 2012
%o (Haskell)
%o a087172 = head . a035516_row -- _Reinhard Zumkeller_, Mar 10 2013
%Y Cf. A000045, A007895, A035516, A035517, A066628, A107017, A130233, A130234, A256654.
%Y Partial sums: A130473.
%K nonn,easy
%O 1,2
%A _Sam Alexander_, Oct 19 2003