%I #66 Jul 25 2016 12:25:10
%S 0,4,28,96,244,516,968,1664,2680,4100,6020,8544,11788,15876,20944,
%T 27136,34608,43524,54060,66400,80740,97284,116248,137856,162344,
%U 189956,220948,255584,294140,336900,384160,436224,493408,556036,624444,698976,779988,867844
%N Number of right isosceles triangles that can be formed from the n^2 points of n X n grid of points (or geoboard).
%C 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.
%H Nathaniel Johnston and Colin Barker, <a href="/A187452/b187452.txt">Table of n, a(n) for n = 1..1000</a> [first 73 terms from Nathaniel Johnston]
%H Margherita Barile, <a href="http://mathworld.wolfram.com/Geoboard.html">MathWorld -- Geoboard.</a>
%H Jessica Gonzalez, <a href="/A187452/a187452.png">Illustration of a(3)=28</a>
%H Nathaniel Johnston, <a href="/A187452/a187452.c.txt">C program for computing terms</a>
%H <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (4,-5,0,5,-4,1).
%F 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]
%F Empirical g.f.: 4*x*(x^2+3*x+1)/((1+x)*(1-x)^5). - _N. J. A. Sloane_, Apr 12 2016
%F Both the recurrence and the g.f. are true. For proof see [Paper in preparation]. - _Warren D. Smith_, Apr 17 2016
%F From _Colin Barker_, Apr 25 2016: (Start)
%F a(n) = (3-3*(-1)^n-16*n^2+10*n^4)/24.
%F a(n) = (5*n^4-8*n^2)/12 for n even.
%F a(n) = (5*n^4-8*n^2+3)/12 for n odd.
%F (End)
%e For n=2 if the four points are labeled
%e ab
%e cd
%e then the triangles are abc, abd, acd, bcd,
%e so a(2)=4.
%e For n=3, label the points
%e abc
%e def
%e ghi
%e 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
%p with(linalg):
%p 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:
%p 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:
%p 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:
%p IsRectangularIsoscelesTriangle:=proc(points) if IsRectangularTriangle(points) and IsIsoscelesTriangle(points) then true: else false: fi: end:
%p 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:
%t LinearRecurrence[{4,-5,0,5,-4,1},{0,4,28,96,244,516},40] (* _Harvey P. Dale_, Apr 29 2016 *)
%o (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
%Y Cf. A045996, A077435, A186434, A189416.
%K nonn,easy
%O 1,2
%A _Martin Renner_, Apr 10 2011, Apr 13 2011
%E a(10) - a(36) from _Nathaniel Johnston_, Apr 25 2011
|