A212959 Number of (w,x,y) such that w,x,y are all in {0,...,n} and |w-x| = |x-y|.
1, 4, 11, 20, 33, 48, 67, 88, 113, 140, 171, 204, 241, 280, 323, 368, 417, 468, 523, 580, 641, 704, 771, 840, 913, 988, 1067, 1148, 1233, 1320, 1411, 1504, 1601, 1700, 1803, 1908, 2017, 2128, 2243, 2360, 2481, 2604, 2731, 2860, 2993, 3128, 3267
Offset: 0
Examples
a(1)=4 counts these (x,y,z): (0,0,0), (1,1,1), (0,1,0), (1,0,1). Numbers congruent to {1, 3} mod 6: 1, 3, 7, 9, 13, 15, 19, ... a(0) = 1; a(1) = 1 + 3 = 4; a(2) = 1 + 3 + 7 = 11; a(3) = 1 + 3 + 7 + 9 = 20; a(4) = 1 + 3 + 7 + 9 + 13 = 33; a(5) = 1 + 3 + 7 + 9 + 13 + 15 = 48; etc. - _Philippe Deléham_, Mar 16 2014
References
- A. Barvinok, Lattice Points and Lattice Polytopes, Chapter 7 in Handbook of Discrete and Computational Geometry, CRC Press, 1997, 133-152.
- P. Gritzmann and J. M. Wills, Lattice Points, Chapter 3.2 in Handbook of Convex Geometry, vol. B, North-Holland, 1993, 765-797.
Links
- Index entries for linear recurrences with constant coefficients, signature (2,0,-2,1).
Programs
-
Mathematica
t = Compile[{{n, _Integer}}, Module[{s = 0}, (Do[If[Abs[w - x] == Abs[x - y], s = s + 1], {w, 0, n}, {x, 0, n}, {y, 0, n}]; s)]]; m = Map[t[#] &, Range[0, 50]] (* A212959 *)
-
PARI
a(n)=(6*n^2+8*n+3)\/4 \\ Charles R Greathouse IV, Jul 28 2015
Formula
a(n) = 2*a(n-1) - 2*a(n-3) + a(n-4).
G.f.: (1+2*x+3*x^2)/((1+x)*(1-x)^3).
a(n) + A212960(n) = (n+1)^3.
a(n) = (6*n^2 + 8*n + 3 + (-1)^n)/4. - Luce ETIENNE, Apr 05 2014
a(n) = 2*A069905(3*(n+1)+2) - 3*(n+1). - Ayoub Saber Rguez, Aug 31 2021
Comments