A135414 a(1)=a(2)=1 and for n>=3, a(n) = n - a(a(n-2)).
1, 1, 2, 3, 4, 4, 4, 5, 6, 6, 7, 8, 9, 9, 9, 10, 11, 12, 12, 12, 13, 14, 14, 15, 16, 17, 17, 17, 18, 19, 19, 20, 21, 22, 22, 22, 23, 24, 25, 25, 25, 26, 27, 27, 28, 29, 30, 30, 30, 31, 32, 33, 33, 33, 34, 35, 35, 36, 37, 38, 38, 38, 39, 40, 40, 41, 42, 43, 43, 43, 44, 45, 46, 46
Offset: 1
Keywords
Examples
x + x^2 + 2*x^3 + 3*x^4 + 4*x^5 + 4*x^6 + 4*x^7 + 5*x^8 + 6*x^9 + 6*x^10 + ...
Links
- D. Platt, Table of n, a(n) for n=1..1999 [From Daniel Platt (d.platt(AT)web.de), Jul 27 2009]
Programs
-
Haskell
a135414 n = a135414_list !! (n-1) a135414_list = 1 : 1 : zipWith (-) [3..] (map a135414 a135414_list) -- Reinhard Zumkeller, Nov 12 2011
-
Mathematica
a[ n_] := 2 - Boole[ n==0] + Quotient[ n, GoldenRatio] + Quotient[ n + 1, GoldenRatio] - Quotient[ n + 3, GoldenRatio] (* Michael Somos, Jun 30 2011 *)
-
PARI
a(n)=2+floor(n*(sqrt(5)-1)/2)+floor((n+1)*(sqrt(5)-1)/2)-floor((n+3)*(sqrt(5)-1)/2)
-
PARI
{a(n) = local(g = (1 + sqrt(5)) / 2); 2 - (n==0) + n\g + (n + 1)\g - (n + 3)\g} /* Michael Somos, Jun 30 2011 */
Formula
a(n) = 2+floor(n*phi)+floor((n+1)*phi)-floor((n+3)*phi) where phi = (sqrt(5)-1)/2.
n = a(n) + a(a(n-2)) unless n = 2 or n = -3. - Michael Somos, Jun 30 2011
Comments