login
Partial sums of A189661.
14

%I #57 Sep 08 2022 08:45:56

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

%T 12,13,13,13,14,14,15,15,15,16,16,17,17,17,18,18,18,19,19,20,20,20,21,

%U 21,22,22,22,23,23,23,24,24,25,25,25,26,26,26,27,27,28,28,28,29,29,30,30,30,31

%N Partial sums of A189661.

%C See A189661.

%H Vincenzo Librandi, <a href="/A189663/b189663.txt">Table of n, a(n) for n = 1..5000</a>

%F a(n) = 2*(n-1)-floor((n-1)*r), where r = (1+sqrt(5))/2 (the golden ratio). - corrected by _R. J. Mathar_, Sep 11 2011

%F a(n) = a(1+a(n-2))+a(n-1-a(n-2)), n>2. - _Frank Ruskey_, Dec 10 2011

%F a(1) = 0, a(2) = 1; a(n) = n - a(n-1) - a(n-a(n-1)) for n > 2. - _Altug Alkan_, Jun 24 2017

%F a(n) = ceiling((n-1)/r^2), where r = (1+sqrt(5))/2. - _Jeffrey Shallit_, Jul 02 2018

%F a(n) = A060144(n-1) + sign(abs(n-1)). - _Primoz Pirnat_, Dec 29 2020

%t (See A189661.)

%t Table[2 (n - 1) - Floor[(n - 1) (1 + Sqrt[5]) / 2], {n, 100}] (* _Vincenzo Librandi_, Jun 26 2017 *)

%o (Python)

%o l=[0, 0, 1]

%o for n in range(3, 101):

%o l.append(n - l[n - 1] - l[n - l[n - 1]])

%o print(l[1:]) # _Indranil Ghosh_, Jun 24 2017, after _Altug Alkan_

%o (Python)

%o from math import isqrt

%o def A189663(n): return (n-1<<1)-(n-1+isqrt(5*(n-1)**2)>>1) # _Chai Wah Wu_, Aug 09 2022

%o (Magma) [2*(n-1)-Floor((n-1)*(1+Sqrt(5))/2): n in [1..100]]; // _Vincenzo Librandi_, Jun 26 2017

%Y Cf. A001622, A189661, A189662, A026356, A060144.

%K nonn

%O 1,4

%A _Clark Kimberling_, Apr 25 2011