This site is supported by donations to The OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A096062 a(1) = a(2) = 1; for n > 2, if a(n-2) + a(n-1) > n then a(n) = abs(a(n-2) - a(n-1)) else a(n) = a(n-2) + a(n-1). 1
 1, 1, 2, 3, 5, 2, 7, 5, 2, 7, 9, 2, 11, 13, 2, 15, 17, 2, 19, 17, 2, 19, 21, 2, 23, 25, 2, 27, 29, 2, 31, 29, 2, 31, 33, 2, 35, 37, 2, 39, 41, 2, 43, 41, 2, 43, 45, 2, 47, 49, 2, 51, 53, 2, 55, 53, 2, 55, 57, 2, 59, 61, 2, 63, 65, 2, 67, 65, 2, 67, 69, 2, 71, 73, 2, 75, 77, 2, 79, 77, 2 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,3 COMMENTS For n > 1: a(n) = 2 if n mod 12 = {0,3,6,9}, a(n) = n if n mod 12 = {5,7}, a(n) = n-1 if n mod 12 = {2,4}, a(n) = n-2 if n mod 12 = {1,11}, a(n) = n-3 if n mod 12 = {8,10}. - Klaus Brockhaus, Jun 19 2004 LINKS Harvey P. Dale, Table of n, a(n) for n = 1..1000 Index entries for linear recurrences with constant coefficients, signature (0,1,1,-1,-1,1,1,-1,-1,1,1,0,-1). FORMULA G.f.: x*(2*x^13 -2*x^12 +x^11 +5*x^10 -x^9 -x^8 +x^7 +x^6 -x^5 +3*x^4 +x^3 +x^2 +x +1) / ((x -1)^2*(x +1)*(x^2 -x +1)*(x^2 +x +1)^2*(x^4 -x^2 +1)). - Colin Barker, Mar 12 2015 EXAMPLE a(8) + a(9) = 5 + 2 = 7 < 10, so a(10) = 7. a(16) + a(17) = 15 + 17 = 32 > 18, so a(18) = abs(15 - 17) = 2. MATHEMATICA nxt[{n_, a_, b_}]:={n+1, b, If[a+b>n+1, Abs[a-b], a+b]}; Transpose[ NestList[ nxt, {2, 1, 1}, 90]][[2]] (* Harvey P. Dale, Sep 22 2014 *) PROG (PARI) m=81; print1(a=1, ", ", b=1, ", "); for(n=3, m, print1(c=if(a+b>n, abs(a-b), a+b), ", "); a=b; b=c) (PARI) Vec(x*(2*x^13 -2*x^12 +x^11 +5*x^10 -x^9 -x^8 +x^7 +x^6 -x^5 +3*x^4 +x^3 +x^2 +x +1) / ((x -1)^2*(x +1)*(x^2 -x +1)*(x^2 +x +1)^2*(x^4 -x^2 +1)) + O(x^100)) \\ Colin Barker, Mar 12 2015 CROSSREFS Sequence in context: A175723 A084346 A165911 * A176195 A231233 A174562 Adjacent sequences:  A096059 A096060 A096061 * A096063 A096064 A096065 KEYWORD nonn,easy AUTHOR Amarnath Murthy, Jun 18 2004 EXTENSIONS Edited, corrected and extended by Klaus Brockhaus, Jun 19 2004 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified October 16 08:03 EDT 2018. Contains 316259 sequences. (Running on oeis4.)