OFFSET
1,2
COMMENTS
This counts triples of distinct points A,B,C such that A,B,C are the vertices of an isosceles triangle with nonzero area, where the angle at B is a right angle. The triangles can have any orientation.
LINKS
Nathaniel Johnston and Colin Barker, Table of n, a(n) for n = 1..1000 [first 73 terms from Nathaniel Johnston]
Margherita Barile, MathWorld -- Geoboard.
Jessica Gonzalez, Illustration of a(3)=28
Nathaniel Johnston, C program for computing terms
Index entries for linear recurrences with constant coefficients, signature (4,-5,0,5,-4,1).
FORMULA
Empirical: a(n)=4*a(n-1)-5*a(n-2)+5*a(n-4)-4*a(n-5)+a(n-6). [R. H. Hardin, Apr 30 2011]
Empirical g.f.: 4*x*(x^2+3*x+1)/((1+x)*(1-x)^5). - N. J. A. Sloane, Apr 12 2016
Both the recurrence and the g.f. are true. For proof see [Paper in preparation]. - Warren D. Smith, Apr 17 2016
From Colin Barker, Apr 25 2016: (Start)
a(n) = (3-3*(-1)^n-16*n^2+10*n^4)/24.
a(n) = (5*n^4-8*n^2)/12 for n even.
a(n) = (5*n^4-8*n^2+3)/12 for n odd.
(End)
EXAMPLE
For n=2 if the four points are labeled
ab
cd
then the triangles are abc, abd, acd, bcd,
so a(2)=4.
For n=3, label the points
abc
def
ghi
The triangles are: abd (4*4 ways), acg (4 ways), ace and dbf (4 ways each), for a total of a(3) = 28. - N. J. A. Sloane, Jun 30 2016
MAPLE
with(linalg):
IsTriangle:=proc(points) local a, b, c; a:=points[3]-points[2]: b:=points[3]-points[1]: c:=points[2]-points[1]: if evalf(norm(a, 2)+norm(b, 2))>evalf(norm(c, 2)) and evalf(norm(a, 2)+norm(c, 2))>evalf(norm(b, 2)) and evalf(norm(b, 2)+norm(c, 2))>evalf(norm(a, 2)) then true: else false: fi: end:
IsRectangularTriangle:=proc(points) local a, b, c; a:=points[3]-points[2]: b:=points[3]-points[1]: c:=points[2]-points[1]: if IsTriangle(points) then if dotprod(a, b)=0 or dotprod(a, c)=0 or dotprod(b, c)=0 then true: else false: fi: else false: fi; end:
IsIsoscelesTriangle:=proc(points) local a, b, c; a:=points[3]-points[2]: b:=points[3]-points[1]: c:=points[2]-points[1]: if IsTriangle(points) then if norm(a, 2)=norm(b, 2) or norm(a, 2)=norm(c, 2) or norm(b, 2)=norm(c, 2) then true: else false: fi: else false: fi; end:
IsRectangularIsoscelesTriangle:=proc(points) if IsRectangularTriangle(points) and IsIsoscelesTriangle(points) then true: else false: fi: end:
a:=proc(n) local P, TriangleSet, i, j, a, b, c; P:=[]: for i from 0 to n do for j from 0 to n do P:=[op(P), [i, j]]: od; od; TriangleSet:={}: for a from 1 to nops(P) do for b from a+1 to nops(P) do for c from b+1 to nops(P) do if IsRectangularIsoscelesTriangle([P[a], P[b], P[c]]) then TriangleSet:={op(TriangleSet), [P[a], P[b], P[c]]}; fi; od; od; od; return(nops(TriangleSet)): end:
MATHEMATICA
LinearRecurrence[{4, -5, 0, 5, -4, 1}, {0, 4, 28, 96, 244, 516}, 40] (* Harvey P. Dale, Apr 29 2016 *)
PROG
(PARI) concat(0, Vec(4*x^2*(1+3*x+x^2)/((1-x)^5*(1+x)) + O(x^50))) \\ Colin Barker, Apr 25 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Martin Renner, Apr 10 2011, Apr 13 2011
EXTENSIONS
a(10) - a(36) from Nathaniel Johnston, Apr 25 2011
STATUS
approved