A189663 Partial sums of A189661.
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, 12, 13, 13, 13, 14, 14, 15, 15, 15, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 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
Offset: 1
Keywords
Links
- Vincenzo Librandi, Table of n, a(n) for n = 1..5000
Programs
-
Magma
[2*(n-1)-Floor((n-1)*(1+Sqrt(5))/2): n in [1..100]]; // Vincenzo Librandi, Jun 26 2017
-
Mathematica
(See A189661.) Table[2 (n - 1) - Floor[(n - 1) (1 + Sqrt[5]) / 2], {n, 100}] (* Vincenzo Librandi, Jun 26 2017 *)
-
Python
l=[0, 0, 1] for n in range(3, 101): l.append(n - l[n - 1] - l[n - l[n - 1]]) print(l[1:]) # Indranil Ghosh, Jun 24 2017, after Altug Alkan
-
Python
from math import isqrt def A189663(n): return (n-1<<1)-(n-1+isqrt(5*(n-1)**2)>>1) # Chai Wah Wu, Aug 09 2022
Formula
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
a(n) = a(1+a(n-2))+a(n-1-a(n-2)), n>2. - Frank Ruskey, Dec 10 2011
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
a(n) = ceiling((n-1)/r^2), where r = (1+sqrt(5))/2. - Jeffrey Shallit, Jul 02 2018
a(n) = A060144(n-1) + sign(abs(n-1)). - Primoz Pirnat, Dec 29 2020
Comments