OFFSET
0,4
COMMENTS
Run lengths in A128218. - Reinhard Zumkeller, Jun 20 2015
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
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
LINKS
Index entries for linear recurrences with constant coefficients, signature (0,2,0,-1).
FORMULA
a(n) = 2*a(n-2) - a(n-4) with a(0)=a(1)=a(2)=1 and a(3)=2.
a(n) = (a(n-2) + a(n-3))/a(n-1).
G.f.: (1 + x - x^2)/(1 - 2*x^2 + x^4).
a(n) = A057979(n+2).
a(n)*a(n+1) = floor((n+2)/2) = A008619(n). - Paul Barry, Feb 27 2009
a(n) = Sum_{k=0..floor(n/2)} binomial(n-k,k)*0^floor((n-2k)/2). - Paul Barry, Feb 27 2009
a(n) = gcd(floor((n+1)/2), (n+1)). - Enrique Pérez Herrero, Mar 13 2012
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
E.g.f.: ((2 + x)*cosh(x) + sinh(x))/2. - Stefano Spezia, Mar 26 2022
a(n) = (-1)^n * a(-2-n) for all n in Z. - Michael Somos, Mar 26 2022
EXAMPLE
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
MATHEMATICA
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 *)
PROG
(PARI) Vec((1+x-x^2)/(1-2*x^2+x^4)+O(x^99)) \\ Charles R Greathouse IV, Jan 12 2012
(PARI) a(n)=gcd(n+1, (n+1)\2) \\ Charles R Greathouse IV, Mar 13 2012
(Haskell)
import Data.List (transpose)
a152271 = a057979 . (+ 2)
a152271_list = concat $ transpose [repeat 1, [1..]]
-- Reinhard Zumkeller, Aug 11 2014
(Python)
def A152271(n): return n+1>>1 if n&1 else 1 # Chai Wah Wu, Jan 04 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Philippe Deléham, Dec 01 2008
STATUS
approved