Project Euler 139 - Pythagorean Tiles

Official link:

Thought Process

Given a triangle (a,b,c), where a < b < c, the square in the middle has length b-a and this square will be able to tile a square of length c if c is divisible by b-a.

Theoretically we could just generate all the triples and their multiples using my Primitive Pythagorean triangle generator, but this would take a very long time.

The key is notice notice that if we have a triangle (a,b,c) that works then all of it's multiples will work as well!

Interactive Code

Enter a number (yourinput)

Code will output the number of triangle with perimeter less than yourinput which satisfy the wanted condition