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.

A211441 Number of ordered triples (w,x,y) with all terms in {-n,...,0,...,n} and w + x + y = 2.

Original entry on oeis.org

0, 3, 15, 33, 57, 87, 123, 165, 213, 267, 327, 393, 465, 543, 627, 717, 813, 915, 1023, 1137, 1257, 1383, 1515, 1653, 1797, 1947, 2103, 2265, 2433, 2607, 2787, 2973, 3165, 3363, 3567, 3777, 3993, 4215, 4443, 4677, 4917, 5163, 5415, 5673, 5937
Offset: 0

Views

Author

Clark Kimberling, Apr 11 2012

Keywords

Comments

For a guide to related sequences, see A211422.
From Klaus Purath, Jan 08 2019: (Start)
Number of dots in a hexagon in which the sides are alternately n-1 and n+3 dots long for n >= 3. a(n) = 3*k^2 + 9*k + 3, where k = n - 1 denotes the number of dots at the shorter side of the hexagon.
Let p be a prime number > 5. Then p divides exactly 2 terms out of any in p consecutive terms. If a(i) and a(k) contain the prime factor p, then i + k == -3 (mod p). (End)
From Klaus Purath, Aug 08 2019: (Start)
Proof of Colin Barker's formulas: The first differences of the sequence for n > 0 are equal to 6*n. We assume that the recurrence a(n) = a(n-1) + 6*n is valid for any n > 1. In it, a(n-1) denotes the number of all ordered triples with -n < w, x, y < n according to the definition of the sequence. Consequently, 6*n must denote the number of all ordered triples containing -n and/or n, which must be proved.
The statement is empirically confirmed for the first n. We show that this applies to any n. With even n we determine all triples {w,x,y} with w = -n, x + y = n + 2 and start the enumeration of the triples with the highest possible value for x and end with the triple where x = y is: {-n, n, 2}, {-n, n-1, 3}, ..., {-n, n-i, 2+i}, ..., {-n, n-(n-2)/2, 2+(n-2)/2}. These are (n-2)/2 + 1 triples.
Now we set w = n and determine all triples {w,x,y} with x + y = 2 - n. We start the enumeration with the smallest possible x and end again, when x = y: {n, -n, 2}, {n, 1-n, 1}, ..., {n, i-n, 2-i}, ..., {n, (n+2)/2-n, 2-(n+2)/2}. These are (n+2)/2 +1 triples. Altogether we get n + 2 triples. Since the first triples of the two enumerations are identical, n + 1 triples remain. To get the ordered triples, they have to be permuted. We take into account that the respectively last triples contain two identical components and that only n - 1 triples consist of three distinct components. Thus the number of ordered triples (w,x,y) totals (n-1)* 3! + 2* 3!/2! = 6*n, which had to be proven.
With odd n we proceed in the same way with the difference that we end the two enumerations when |x - y| = 1. With w = -n we start with the largest possible x: {-n, n, 2}, {-n, n-1, 3}, ..., {-n, n-i, 2+i}, ..., {-n, n-(n-3)/2, 2+(n-3)/2}. These are (n-3)/2 + 1 triples.
For w = n we start with the smallest possible x: {n, -n, 2}, {n, 1-n, 1}, ..., {n, i-n, 2-i}, ..., {n, (n+1)/2-n, 2-(n+1)/2}. These are (n+1)/2 + 1 triples. Altogether these are n + 1 triples. Because the respectively first triples are identical here, n triples remain, and by permutation this results in 6*n ordered triples. Thus the proof is complete.
(End)

Examples

			From _Klaus Purath_, Jan 08 2019: (Start)
Illustration of initial terms for n >= 3:
.
.                                          o o o o o o o o
.                     o o o o o o o       o o o o o o o o o
.    o o o o o o     o o o o o o o o     o o o o o o o o o o
.   o o o o o o o   o o o o o o o o o   o o o o o o o o o o o
.    o o o o o o     o o o o o o o o     o o o o o o o o o o
.     o o o o o       o o o o o o o       o o o o o o o o o
.      o o o o         o o o o o o         o o o o o o o o
.       o o o           o o o o o           o o o o o o o
.        o o             o o o o             o o o o o o
.                         o o o               o o o o o
.                                              o o o o
.
.   a(3) = 33          a(4) = 57             a(5) = 87
(End)
		

Crossrefs

Cf. A211422.

Programs

  • GAP
    b:=[3,15,33];; for n in [4..50] do b[n]:=3*b[n-1]-3*b[n-2]+b[n-3]; od; a:=Concatenation([0],b);; Print(a); # Muniru A Asiru, Jan 23 2019
    
  • Magma
    [n le 0 select 0 else 3*(n^2+n-1): n in [0..50]]; // G. C. Greubel, Feb 10 2019
    
  • Mathematica
    t[n_]:= t[n]= Flatten[Table[w+x+y-2, {w, -n, n}, {x, -n, n}, {y, -n, n}]]
    c[n_]:= Count[t[n], 0]
    t = Table[c[n], {n, 0, 60}] (* A211441 *)
    t/3                         (* A028387 *)
    Join[{0},LinearRecurrence[{3,-3,1},{3,15,33},50]] (* Harvey P. Dale, May 10 2012 *)
  • PARI
    vector(50, n, n--; if(n==0, 0, 3*(n^2+n-1))) \\ G. C. Greubel, Feb 10 2019
    
  • Sage
    [0] + [3*(n^2+n-1) for n in (1..50)] # G. C. Greubel, Feb 10 2019

Formula

From Colin Barker, Apr 18 2012: (Start)
a(n) = 3*(n^2 + n - 1) for n > 0.
a(n) = 3*a(n-1) - 3*a(n-2) + a(n-3) for n > 3.
G.f.: 3*x*(1 + 2*x - x^2)/(1 - x)^3. (End)
From Klaus Purath, Jan 08 2019: (Start)
a(n) = 3*A028387(n-1).
a(n) = 3*A028552(n-1) + 3.
a(n) = 3*A002378(n) - 3.
a(n) = 3*A003215(n) - 4.
a(n) + a(n+1) + a(n+2) + a(n+3) = 3*(2*n+4)^2 = 12*(n+2)^2 for n > 0.
a(n) + a(n+1) + a(n+2) = 3*A003215(n+1) - 6 for n > 0. (End)
E.g.f.: 3 + 3*exp(x)*(-1 + 2*x + x^2). - Stefano Spezia, Aug 08 2019