Project Euler Problem 600 Integer sided equiangular hexagons - Solution
Integer sided equiangular hexagons Problem 600 Let H ( n ) be the number of distinct integer sided equiangular convex hexagons with perimeter not exceeding n . Hexagons are distinct if and only if they are not congruent . You are given H (6) = 1, H (12) = 10, H (100) = 31248. Find H (55106). Equiangular hexagons with perimeter not exceeding 12 First convert this problem into below equivalent problem: Find integers: a,b,c (1) a<=b<=c (2) 3x-(a+b+c)<=n (3) x>=(a+b+c) The 2 problems are equivalent, how? a) Add 3 small triangles (a,a,a), (b,b,b), (c,c,c) at each corner of the hexagons, to form a large triangle (x,x,x), due to summitry, simple define (1) a<=b<=c b) As each hexagon has 2 possible x- triangles, in order not to count the same solution twice, always use the one with a smaller x. Thus, we have 3x <= c+2(x-b-c)+b+2(x-a-b...