cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A004524 Three even followed by one odd.

Original entry on oeis.org

0, 0, 0, 1, 2, 2, 2, 3, 4, 4, 4, 5, 6, 6, 6, 7, 8, 8, 8, 9, 10, 10, 10, 11, 12, 12, 12, 13, 14, 14, 14, 15, 16, 16, 16, 17, 18, 18, 18, 19, 20, 20, 20, 21, 22, 22, 22, 23, 24, 24, 24, 25, 26, 26, 26, 27, 28, 28, 28, 29, 30, 30, 30, 31, 32, 32, 32, 33, 34, 34, 34, 35, 36, 36, 36, 37
Offset: 0

Views

Author

Keywords

Comments

Ignoring the first term, for n >= 0, n/2 rounded by the method called "banker's rounding", "statistician's rounding", or "round-to-even" gives 0, 0, 1, 2, 2, 2, 3, ..., where this method rounds k + 0.5 to k if positive integer k is even but rounds k + 0.5 to k + 1 when k + 1 is even. (If the method is indeed defined such that the above statement is also true with the word "positive" removed, then the first 0 term need not be ignored and this sequence can be further extended symmetrically with a(m) = -a(-m) for all integers m, an advantage over usual rounding.) The corresponding sequence for n/2 rounded by the common method is A004526 (considered as beginning with n = -1). - Rick L. Shepherd, Nov 16 2006
From Anthony Hernandez, Aug 08 2016: (Start)
Arrange the positive integers starting at 1 into a triangular array
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35 36
and let e(n) count the even numbers in the n-th row of the array. Then e(n) = a(n+1). For example, e(6) = a(7) = 3 and there are three even numbers in the 6th row of the array. For the count of odd numbers, f(n), look at the sequence A004525. (End)
Also the domination number of the (n-1) X (n-1) white bishop graph. - Eric W. Weisstein, Jun 26 2017
Let (b(n)) be the p-INVERT of A010892 using p(S) = 1 - S^2; then b(n) = a(n+1) for n >= 0. See A292301. - Clark Kimberling, Sep 30 2017
Also the total domination number of the (n-2)-complete graph (for n>3), (n-2)-cycle graph (for n>4), and (n-2)-pan graph (for n>4). - Eric W. Weisstein, Apr 07 2018
The sequence is the interleaving of the duplicated even integers (A052928) with the nonnegative integers (A001477). - Guenther Schrack, Mar 05 2019

Examples

			G.f. = x^3 + 2*x^4 + 2*x^5 + 2*x^6 + 3*x^7 + 4*x^8 + 4*x^9 + 4*x^10 + ...
		

Crossrefs

Zero followed by partial sums of A021913.
First differences of A011848.

Programs

  • GAP
    List([0..79],n->Int(n/4)+Int((n+1)/4)); # Muniru A Asiru, Mar 06 2019
    
  • Haskell
    a004524 n = n `div` 4 + (n + 1) `div` 4
    a004524_list = 0 : 0 : 0 : 1 : map (+ 2) a004524_list
    -- Reinhard Zumkeller, Feb 22 2013, Jul 14 2012
    
  • Magma
    [Floor(n/4)+Floor((n+1)/4) : n in [0..80]]; // Wesley Ivan Hurt, Jul 21 2014
    
  • Maple
    A004524:=n->floor(n/4)+floor((n+1)/4): seq(A004524(n), n=0..50); # Wesley Ivan Hurt, Jul 21 2014
  • Mathematica
    Table[Floor[n/4] + Floor[(n + 1)/4], {n, 0, 80}] (* Wesley Ivan Hurt, Jul 21 2014 *)
    Flatten[Table[{n, n, n, n + 1}, {n, 0, 38, 2}]] (* Alonso del Arte, Aug 10 2016 *)
    Table[(n + Cos[n Pi/2] - 1)/2, {n, 0, 80}] (* Eric W. Weisstein, Apr 07 2018 *)
    Table[Floor[n/2 - 1] + Ceiling[n/4 - 1/2] - Floor[n/4 - 1/2], {n, 0, 80}] (* Eric W. Weisstein, Apr 07 2018 *)
    LinearRecurrence[{2, -2, 2, -1}, {0, 0, 1, 2}, {0, 80}] (* Eric W. Weisstein, Apr 07 2018 *)
    CoefficientList[Series[x^3/((1 - x)^2 (1 + x^2)), {x, 0, 80}], x] (* Eric W. Weisstein, Apr 07 2018 *)
    Table[Round[(n - 1)/2], {n, 0, 20}] (* Eric W. Weisstein, Jun 19 2024 *)
    Round[(Range[0, 20] - 1)/2] (* Eric W. Weisstein, Jun 19 2024 *)
    Table[PadRight[{},If[EvenQ[n],3,1],n],{n,0,40}]//Flatten (* Harvey P. Dale, Dec 11 2024 *)
  • PARI
    {a(n) = n\4 + (n+1)\4}; /* Michael Somos, Jul 19 2003 */
    
  • PARI
    concat([0,0,0], Vec(x^3/((1-x)^2*(1+x^2)) + O(x^80))) \\ Altug Alkan, Oct 31 2015
    
  • Python
    def A004524(n): return (n>>2)+(n+1>>2) # Chai Wah Wu, Jul 29 2022
  • Sage
    [floor(n/4)+floor((n+1)/4) for n in (0..80)] # G. C. Greubel, Mar 08 2019
    

Formula

a(n) = a(n-1) - a(n-2) + a(n-3) + 1 = (n-1) - A004525(n-1). - Henry Bottomley, Mar 08 2000
G.f.: x^3/((1 - x)^2*(1 + x^2)) = x^3*(1 - x^2)/((1 - x)^2*(1 - x^4)). - Michael Somos, Jul 19 2003
If the sequence is extended to negative arguments in the natural way, it satisfies a(n) = -a(2-n) for all n in Z. - Michael Somos, Jul 19 2003
a(n) = A092038(n-3) for n > 4. - Reinhard Zumkeller, Mar 28 2004
From Paul Barry, Oct 27 2004: (Start)
E.g.f.: (exp(x)*(x-1) + cos(x))/2.
a(n) = (n - 1 - cos(Pi*(n-2)/2))/2. (End)
a(n+3) = Sum_{k = 0..n} (1 + (-1)^C(n,2))/2. - Paul Barry, Mar 31 2008
a(n) = floor(n/4) + floor((n+1)/4). - Arkadiusz Wesolowski, Sep 19 2012
From Wesley Ivan Hurt, Jul 21 2014, Oct 31 2015: (Start)
a(n) = Sum_{i = 1..n-1} (floor(i/2) mod 2).
a(n) = n/2 - sqrt(n^2 mod 8)/2. (End)
Euler transform of length 4 sequence [2, -1, 0, 1]. - Michael Somos, Apr 03 2017
a(n) = (2*n - 2 + (1 + (-1)^n)*(-1)^(n*(n-1)/2))/4. - Guenther Schrack, Mar 04 2019
Sum_{n>=3} (-1)^(n+1)/a(n) = log(2) (A002162). - Amiram Eldar, Sep 29 2022