%I #13 May 08 2022 08:48:18
%S 1,1,1,1,3,1,3,1,3,3,3,3,5,3,3,3,3,5,3,3,3,3,5,3,3,5,3,5,3,3,5,3,5,7,
%T 3,5,3,5,5,3,5,3,5,5,3,5,7,5,5,3,5,5,5,5,3,5,5,5,5,7,5,5,5,5,5,5,5,7,
%U 5,5,5,5,7,5,5,5,5,5,5,5,7,5,5,5,5,7,5,5,9,5,5,5,5,7,5,5,5,5,7,5,5,7,5,5,5
%N Number of consecutive 1's in the continued fraction for floor(n*phi)/n where phi = (1+sqrt(5))/2 (A001622).
%C Terms are always odd.
%H Amiram Eldar, <a href="/A110919/b110919.txt">Table of n, a(n) for n = 1..10000</a>
%H Amiram Eldar, <a href="/A110919/a110919.jpg">Plot of Sum_{k=1..n} a(n)/(n*log(n)) for n = 100..100000</a>
%F Sum_{k=1..n} a(k) seems to be asymptotic to c*n*log(n) with c around 1.
%e The continued fraction for floor(128*phi)/128 is [1, 1, 1, 1, 1, 1, 1, 2, 1, 2] with 7 consecutive 1's, thus a(128) = 7.
%t a[1] = 1; a[n_] := -1 + FirstPosition[ContinuedFraction[Floor[n*GoldenRatio]/n], _?(# > 1 &)][[1]]; Array[a, 100] (* _Amiram Eldar_, May 08 2022 *)
%o (PARI) a(n)=if(n<2,1,s=1;while(component(contfrac(floor(n*(1+sqrt(5))/2)/n),s)==1,s++);s-1)
%Y Cf. A001622.
%K nonn
%O 1,5
%A _Benoit Cloitre_, Sep 22 2005
|