Definition
An "integer triangle" is one with integer coordinates. For example the following triangle is an integer triangle:
(0, 0), (0, 1), (1, 2) with perimeter 1 + sqrt(2) + sqrt(5) ≈ 4.650.
Task
The goal of this challenge is to count all integer triangles (up to congruence) with perimeter less than n.
Input and Output
The argument will be given as an integer, and the output should be the number of triangles with perimeter strictly less than the argument.
Examples
The smallest integer triangle by perimeter is congruent to
(0, 0), (0, 1), (1, 0) which has perimeter 2 + sqrt(2) ≈ 3.414
The next smallest are:
(0, 0), (0, 1), (1, 2) with perimeter 1 + sqrt(2) + sqrt(5) ≈ 4.650,
(0, 0), (0, 2), (1, 1) with perimeter 2 + 2sqrt(2) ≈ 4.828,
(0, 0), (0, 2), (1, 0) with perimeter 3 + sqrt(5) ≈ 5.236, and
(0, 0), (1, 2), (2, 1) with perimeter sqrt(2) + 2sqrt(5) ≈ 5.886
Test cases:
a(1) = 0
a(2) = 0
a(3) = 0
a(4) = 1
a(5) = 3
a(6) = 5
a(7) = 11
a(8) = 18
a(9) = 29
a(10) = 44
a(12) = 94
a(20) = 738
a(30) = 3756
a(40) = 11875
I have coordinates for each of the triangles in this Gist.
Warnings
Notice that two non-congruent triangles can have the same perimeter:
(0, 0), (0, 3), (3, 0) and (0, 0), (0, 1), (3, 4) both have perimeter 6 + 3sqrt(2).
Also keep in mind that the inequality is strict; the 3-4-5 pythagorean triangle should be counted by a(13), not a(12).
Scoring
This is code-golf—the shortest code wins!