OFFSET
1,4
COMMENTS
See A189661.
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..5000
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
MATHEMATICA
(See A189661.)
Table[2 (n - 1) - Floor[(n - 1) (1 + Sqrt[5]) / 2], {n, 100}] (* Vincenzo Librandi, Jun 26 2017 *)
PROG
(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
(Magma) [2*(n-1)-Floor((n-1)*(1+Sqrt(5))/2): n in [1..100]]; // Vincenzo Librandi, Jun 26 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Clark Kimberling, Apr 25 2011
STATUS
approved