OFFSET
1,2
COMMENTS
a(n) is the count of terms a(n+1) present so far in the sequence, with a(n+1) included in the count; example: a(1) = 1 "says" that there is 1 term "2" so far in the sequence; a(2) = 2 "says" that there are 2 terms "1" so far in the sequence... etc. This comment was inspired by A039617. - Eric Angelini, Mar 03 2020
LINKS
Index entries for linear recurrences with constant coefficients, signature (0, 2, 0, -1).
FORMULA
a(n)=1+(binomial(n+1,2)mod n)=1+(binomial(n+1,n-1)mod n).
a(n)=binomial(n+2,2) mod n = binomial(n+2,n) mod n for n>2.
a(n)=1+(1+(-1)^n)*n/4.
a(n)=1+(A000217(n) mod n).
a(n)=a(n-2)+1, if n is even, a(n)=a(n-2) if n is odd.
a(n)=a(n-2)+1-(n mod 2)=a(n-2)+(1+(-1)^n)/2 for n>2.
a(n)=(a(n-3)+a(n-2))/a(n-1) for n>3.
G.f.: g(x)=x(1+2x-x^2-x^3)/(1-x^2)^2.
G.f.: (Q(0)-1-x)/x^2, where Q(k)= 1 + (k+1)*x/(1 - x/(x + (k+1)/Q(k+1))); (continued fraction). - Sergei N. Gladkovskii, Apr 23 2013
a(n) = 2*a(n-2)-a(n-4) for n > 4. - Chai Wah Wu, May 26 2016
E.g.f.: exp(x) - 1 + x*sinh(x)/2. - Robert Israel, May 27 2016
MAPLE
seq([1, n][], n=2..100); # Robert Israel, May 27 2016
MATHEMATICA
Riffle[Range[2, 50], 1, {1, -1, 2}] (* Harvey P. Dale, Jan 19 2013 *)
PROG
(Haskell)
import Data.List (transpose)
a133622 n = (1 - m) * n' + 1 where (n', m) = divMod n 2
a133622_list = concat $ transpose [[1, 1 ..], [2 ..]]
-- Reinhard Zumkeller, Feb 20 2015
(PARI) a(n)=if(n%2, 1, n/2+1) \\ Charles R Greathouse IV, Sep 02 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Hieronymus Fischer, Sep 30 2007
STATUS
approved