%I #67 Feb 16 2024 10:22:35
%S 1,1,1,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,10,1,11,1,12,1,13,1,14,1,15,1,
%T 16,1,17,1,18,1,19,1,20,1,21,1,22,1,23,1,24,1,25,1,26,1,27,1,28,1,29,
%U 1,30,1,31,1,32,1,33,1,34,1,35,1,36,1,37,1,38,1,39,1,40,1,41,1,42,1,43,1,44
%N a(n)=1 for even n and (n+1)/2 for odd n.
%C A000012 and A000027 interleaved. - _Omar E. Pol_, Mar 12 2012
%C Run lengths in A128218. - _Reinhard Zumkeller_, Jun 20 2015
%C a(n+1) is the number of reversible binary strings of length n+1 with Hamming weight 1 or 2 such that the 1's are separated by an even number of 0's. - _Christian Barrientos_, Jan 28 2019
%C Simple continued fraction of -1 + BesselJ(1,2)/BesselJ(2,2) = 1/(1 + 1/(1 + 1/(1 + 1/(2 + 1/(1 + 1/(3 + 1/(1 + 1/(4 + 1/(1 + ... ))))))))). - _Peter Bala_, Oct 06 2023
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (0,2,0,-1).
%F a(n) = 2*a(n-2) - a(n-4) with a(0)=a(1)=a(2)=1 and a(3)=2.
%F a(n) = (a(n-2) + a(n-3))/a(n-1).
%F G.f.: (1 + x - x^2)/(1 - 2*x^2 + x^4).
%F a(n) = A057979(n+2).
%F a(n)*a(n+1) = floor((n+2)/2) = A008619(n). - _Paul Barry_, Feb 27 2009
%F a(n) = Sum_{k=0..floor(n/2)} binomial(n-k,k)*0^floor((n-2k)/2). - _Paul Barry_, Feb 27 2009
%F a(n) = gcd(floor((n+1)/2), (n+1)). - _Enrique Pérez Herrero_, Mar 13 2012
%F G.f.: U(0) where U(k) = 1 + x*(k+1)/(1 - x/(x + (k+1)/U(k+1))) ; (continued fraction, 3-step). - _Sergei N. Gladkovskii_, Oct 04 2012
%F E.g.f.: ((2 + x)*cosh(x) + sinh(x))/2. - _Stefano Spezia_, Mar 26 2022
%F a(n) = (-1)^n * a(-2-n) for all n in Z. - _Michael Somos_, Mar 26 2022
%e G.f. = 1 + x + x^2 + 2*x^3 + x^4 + 3*x^5 + x^6 + 4*x^7 + x^8 + ... - _Michael Somos_, Mar 26 2022
%t Table[If[EvenQ[n],1,(n+1)/2],{n,0,120}] (* or *) LinearRecurrence[{0,2,0,-1},{1,1,1,2},120] (* or *) Riffle[Range[60],1,{1,-1,2}] (* _Harvey P. Dale_, Jan 20 2018 *)
%o (PARI) Vec((1+x-x^2)/(1-2*x^2+x^4)+O(x^99)) \\ _Charles R Greathouse IV_, Jan 12 2012
%o (PARI) a(n)=gcd(n+1,(n+1)\2) \\ _Charles R Greathouse IV_, Mar 13 2012
%o (Haskell)
%o import Data.List (transpose)
%o a152271 = a057979 . (+ 2)
%o a152271_list = concat $ transpose [repeat 1, [1..]]
%o -- _Reinhard Zumkeller_, Aug 11 2014
%o (Python)
%o def A152271(n): return n+1>>1 if n&1 else 1 # _Chai Wah Wu_, Jan 04 2024
%Y Cf. A000012, A000027, A008619, A057979, A128218.
%K nonn,easy
%O 0,4
%A _Philippe Deléham_, Dec 01 2008