login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A079354
a(1)=1; a(n)=a(n-1)-1 if n is already in the sequence, a(n)=a(n-1)+3 otherwise.
3
1, 4, 7, 6, 9, 8, 7, 6, 5, 8, 11, 14, 17, 16, 19, 18, 17, 16, 15, 18, 21, 24, 27, 26, 29, 28, 27, 26, 25, 28, 31, 34, 37, 36, 39, 38, 37, 36, 35, 38, 41, 44, 47, 46, 49, 48, 47, 46, 45, 48, 51, 54, 57, 56, 59, 58, 57, 56, 55, 58, 61, 64, 67, 66, 69, 68, 67, 66, 65, 68, 71, 74, 77
OFFSET
1,2
COMMENTS
Starting with a(1)=0 and same definition, a(n)=n+(-1)^n (cf. A004442)
FORMULA
a(n)-n is periodic with period (0, 2, 4, 2, 4, 2, 0, -2, -4, -2) of length 10.
a(10t+i) = 10t+c_i, 1<=i<=10, c_i=(1, 4, 7, 6, 9, 8, 7, 6, 5, 8). a(n) = n iff n == 1 or 7 (mod 10).
G.f.: x*(2*x^10+3*x^9-x^8-x^7-x^6-x^5+3*x^4-x^3+3*x^2+3*x+1) / (x^11-x^10-x+1). - Colin Barker, Oct 16 2013
MATHEMATICA
LinearRecurrence[{1, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1}, {1, 4, 7, 6, 9, 8, 7, 6, 5, 8, 11}, 80] (* Harvey P. Dale, Feb 01 2015 *)
PROG
(PARI) Vec(x*(2*x^10+3*x^9-x^8-x^7-x^6-x^5+3*x^4-x^3+3*x^2+3*x+1)/(x^11-x^10-x+1) + O(x^100)) \\ Colin Barker, Oct 16 2013
CROSSREFS
Sequence in context: A140877 A293904 A069286 * A354763 A255248 A122460
KEYWORD
nonn,easy
AUTHOR
STATUS
approved