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”).

A129000
Start with an integer (in this case, 1). First, add 5 or 8 if the integer is odd or even, respectively. Then divide by 2.
1
1, 3, 4, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7
OFFSET
1,2
FORMULA
a(n) = (a(n-1) + b)/d, if a(n) even = (a(n-1) + c)/d, if a(n) odd (starting with a(1)=1, b=5, c=8, d=2).
EXAMPLE
a(7) = 6 because (7 + 5)/2 = 6.
MATHEMATICA
a={1}; k=1; For[n=1, n<70, n++, If[EvenQ[k], k=k+8, k=k+5]; k=k/2; AppendTo[a, k]]; a (* Stefan Steinerberger, May 26 2007 *)
PROG
(Scheme, with memoization-macro definec) (definec (A129000 n) (if (= 1 n) n (let ((prev (A129000 (- n 1)))) (/ (+ prev (if (odd? prev) 5 8)) 2)))) ;; Antti Karttunen, Sep 14 2017
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Adam F. Schwartz (adam_s(AT)mit.edu), May 01 2007
EXTENSIONS
More terms from Stefan Steinerberger, May 26 2007
STATUS
approved