login
The left budding sequence: # of i such that 0<i<=n and 0 < {tau*i} <= {tau*n}, where {} is fractional part.
7

%I #28 Aug 13 2021 08:55:34

%S 1,1,3,2,1,5,3,8,5,2,9,5,1,10,5,15,9,3,15,8,21,13,5,20,11,2,19,9,27,

%T 16,5,25,13,1,23,10,33,19,5,30,15,41,25,9,37,20,3,33,15,46,27,8,41,21,

%U 55,34,13,49,27,5,43,20,59,35,11,52,27,2,45,19,63,36,9,55,27,74,45,16,65

%N The left budding sequence: # of i such that 0<i<=n and 0 < {tau*i} <= {tau*n}, where {} is fractional part.

%D J. H. Conway, personal communication.

%H Reinhard Zumkeller, <a href="/A019587/b019587.txt">Table of n, a(n) for n = 1..1000</a>

%H N. J. A. Sloane, <a href="/classic.html#WYTH">Classic Sequences</a>

%F a(n)+A194733(n)=n.

%e {r}=0.61...; {2r}=0.23...; {3r}=0.85...; {4r}=0.47...;

%e so that a(4)=2.

%p Digits := 100;

%p A019587 := proc(n::posint)

%p local a,k,phi,kfrac,nfrac ;

%p phi := (1+sqrt(5))/2 ;

%p a :=0 ;

%p nfrac := n*phi-floor(n*phi) ;

%p for k from 1 to n do

%p kfrac := k*phi-floor(k*phi) ;

%p if evalf(kfrac-nfrac) <= 0 then

%p a := a+1 ;

%p end if;

%p end do:

%p a ;

%p end proc:

%p seq(A019587(n),n=1..100) ; # _R. J. Mathar_, Aug 13 2021

%t r = GoldenRatio; p[x_] := FractionalPart[x];

%t u[n_, k_] := If[p[k*r] <= p[n*r], 1, 0]

%t v[n_, k_] := If[p[k*r] > p[n*r], 1, 0]

%t s[n_] := Sum[u[n, k], {k, 1, n}]

%t t[n_] := Sum[v[n, k], {k, 1, n}]

%t Table[s[n], {n, 1, 100}] (* A019587 *)

%t Table[t[n], {n, 1, 100}] (* A194733 *)

%t (* _Clark Kimberling_, Sep 02 2011 *)

%o (Haskell)

%o a019587 n = length $ filter (<= nTau) $

%o map (snd . properFraction . (* tau) . fromInteger) [1..n]

%o where (_, nTau) = properFraction (tau * fromInteger n)

%o tau = (1 + sqrt 5) / 2

%o -- _Reinhard Zumkeller_, Jan 28 2012

%Y Cf. A019588, A194733, A193738.

%K nonn,easy,nice

%O 1,3

%A _N. J. A. Sloane_ and _J. H. Conway_

%E Extended by _Ray Chandler_, Apr 18 2009