A187452 Number of right isosceles triangles that can be formed from the n^2 points of n X n grid of points (or geoboard).
0, 4, 28, 96, 244, 516, 968, 1664, 2680, 4100, 6020, 8544, 11788, 15876, 20944, 27136, 34608, 43524, 54060, 66400, 80740, 97284, 116248, 137856, 162344, 189956, 220948, 255584, 294140, 336900, 384160, 436224, 493408, 556036, 624444, 698976, 779988, 867844
Offset: 1
Examples
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
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).
Programs
-
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 *)
-
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
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)
Extensions
a(10) - a(36) from Nathaniel Johnston, Apr 25 2011
Comments