login
a(n) = n - the largest Fibonacci number <= n.
6

%I #11 Feb 02 2016 02:55:49

%S 0,0,0,0,1,0,1,2,0,1,2,3,4,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,8,9,10,11,

%T 12,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,0,1,2,3,4,5,

%U 6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30

%N a(n) = n - the largest Fibonacci number <= n.

%H Harry J. Smith, <a href="/A066628/b066628.txt">Table of n, a(n) for n = 0..1000</a>

%F a(n) = n - A087172(n). - _Michel Marcus_, Feb 02 2016

%t f[n_] := Block[{k = 1}, While[Fibonacci[k] <= n, k++ ]; Return[n - Fibonacci[k - 1]]]; Table[ f[n], {n, 0, 100} ]

%o (PARI) { k=0; f=0; for (n=0, 1000, while (f <= n, s=f; k++; f=fibonacci(k)); write("b066628.txt", n, " ", n - s) ) } \\ _Harry J. Smith_, Mar 14 2010

%Y Cf. A000045, A087172.

%K nonn

%O 0,8

%A _Amarnath Murthy_, Dec 25 2001

%E Corrected and extended by _Robert G. Wilson v_, Dec 28 2001