Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #58 Oct 07 2023 05:06:10
%S 0,2,1,6,2,10,3,14,4,18,5,22,6,26,7,30,8,34,9,38,10,42,11,46,12,50,13,
%T 54,14,58,15,62,16,66,17,70,18,74,19,78,20,82,21,86,22,90,23,94,24,98,
%U 25,102,26,106,27,110,28,114,29,118,30,122,31,126,32,130,33,134,34,138,35
%N Halve every even number, double every odd number.
%C a(a(m)) = m for all m with gcd(m, 4) <= 2.
%H Harry J. Smith, <a href="/A064680/b064680.txt">Table of n, a(n) for n = 0..1000</a>, (corrected by _Peter Luschny_, Jan 19 2019)
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (0,2,0,-1).
%F a(n) = n * 2^(2 * (n mod 2) - 1).
%F G.f.: x*(2+x+2*x^2)/(1-x^2)^2.
%F a(n) = 2*a(n-2) - a(n-4) for n>3.
%F a(n)*a(n+3) = -2 + a(n+1)*a(n+2).
%F a(2*n) = A001477(n), a(1+2*n) = A016825(n). - _Paul Curtz_, Mar 09 2011
%F a(n) = n*(5-3*(-1)^n)/4. - _Bruno Berselli_, Mar 09 2011
%F a(n)= (period 4 sequence: repeat 2, 2, 1, 2) * (A060819(n)=0,1,1,3,1,5,...). - _Paul Curtz_, Mar 10 2011
%F E.g.f.: x*(sinh(x) + 4*cosh(x))/2. - _Ilya Gutkovskiy_, Jul 24 2016
%F a(n) = lcm(numerator(n/2), denominator(n/2)). - _Wesley Ivan Hurt_, Jul 24 2016
%F a(n) = A176447(n) + n. - _Filip Zaludek_, Dec 10 2016
%F From _Amiram Eldar_, Oct 07 2023: (Start)
%F a(n) = lcm(n,2) / gcd(n,2).
%F Sum_{k=1..n} a(k) ~ (5/8)*n^2. (End)
%p A064680:=n->n*(5-3*(-1)^n)/4: seq(A064680(n), n=0..100); # _Wesley Ivan Hurt_, Jul 24 2016
%t f[n_] := 2^(2 Mod[n, 2] - 1) n; Array[f, 70, 0] (* Or *)
%t f[n_] := If[ OddQ@ n, 2 n, n/2]; Array[f, 71, 0] (* Or *)
%t CoefficientList[ Series[x (2 + x + 2 x^2)/(1 - x^2)^2, {x, 0, 70}], x] (* _Robert G. Wilson v_ *)
%o (PARI) a(n) = if (n%2, 2*n, n/2); \\ _Harry J. Smith_, Sep 22 2009
%o (Magma) [IsEven(n) select n/2 else 2*n: n in [0..70]]; // _Bruno Berselli_, Mar 09 2011
%o (Haskell)
%o a064680 n = a064680_list !! n
%o a064680_list = zipWith ($) (cycle [(`div` 2), (* 2)]) [0..]
%o -- _Reinhard Zumkeller_, Jul 25 2012
%Y Cf. A001477, A016825, A026741, A060819, A109043, A176447.
%K nonn,easy
%O 0,2
%A _Reinhard Zumkeller_, Oct 16 2001