OFFSET
0,4
EXAMPLE
6 = 111.01101010... in base phi using the least-greedy algorithm, so A118240(6)=111, so a(6)=7.
PROG
(Language?)
constant (float): phi=(sqrt(5)+1)/2;
variable (float): lphi=phi^floor[log(n)/log(phi)];
variable (float): rem=n;
variable (integer): count=0;
loop: while lphi>1 (count=count*2; lphi=lphi/phi; if(rem > lphi*phi) { rem=rem-lphi; count++; }}
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Graeme McRae, Apr 17 2006
STATUS
approved