OFFSET
1,2
COMMENTS
Suggested by a puzzle in Mitteilungen der DMV, although I do not know if this solution is what they had in mind.
REFERENCES
Frank Lutz and Brigitte Lutz-Westphal, Eigenwillige Zahlen, Mitteilungen der DMV, 2013, Band 21, Heft 1 (p. 32).
LINKS
Index entries for linear recurrences with constant coefficients, signature (0,1,0,1,0,-1).
FORMULA
Conjecture: a(n) = (3+3*(-1)^n+(-i)^n+i^n+n-(-1)^n*n)/2 where i=sqrt(-1). G.f.: -x*(4*x^5-x^4-2*x^3-2*x^2-2*x-1) / ((x-1)^2*(x+1)^2*(x^2+1)). - Colin Barker, Oct 09 2013
MAPLE
f:=proc(n) if (n mod 4) = 0 then 4 elif (n mod 4) = 2 then 2; else n; fi; end;
MATHEMATICA
Table[Which[Divisible[n, 4], 4, Divisible[n, 2], 2, True, n], {n, 100}] (* or *) LinearRecurrence[{0, 1, 0, 1, 0, -1}, {1, 2, 3, 4, 5, 2}, 100] (* Harvey P. Dale, Dec 03 2017 *)
PROG
(Haskell)
a230089 n = if odd n then n else if mod n 4 == 0 then 4 else 2
-- Reinhard Zumkeller, Oct 09 2013
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Oct 08 2013
STATUS
approved