This site is supported by donations to The OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A230089 If n is divisible by 4 then 4, if n is divisible by 2 then 2, otherwise n. 1
 1, 2, 3, 4, 5, 2, 7, 4, 9, 2, 11, 4, 13, 2, 15, 4, 17, 2, 19, 4, 21, 2, 23, 4, 25, 2, 27, 4, 29, 2, 31, 4, 33, 2, 35, 4, 37, 2, 39, 4, 41, 2, 43, 4, 45, 2, 47, 4, 49, 2, 51, 4, 53, 2, 55, 4, 57, 2, 59, 4, 61, 2, 63, 4, 65, 2, 67, 4, 69, 2, 71, 4, 73, 2, 75, 4, 77, 2, 79, 4, 81, 2, 83, 4, 85, 2, 87, 4, 89, 2 (list; graph; refs; listen; history; text; internal format)
 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. a(A008586(n)) = 4; a(A005408(n)) = A005408(n). - Reinhard Zumkeller, Oct 09 2013 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 Cf. A005843. Sequence in context: A026362 A223490 A244734 * A081811 A304181 A034684 Adjacent sequences:  A230086 A230087 A230088 * A230090 A230091 A230092 KEYWORD nonn,easy AUTHOR N. J. A. Sloane, Oct 08 2013 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
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified October 15 10:15 EDT 2019. Contains 328026 sequences. (Running on oeis4.)