cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A259446 Number of triangles with sides pairwise relatively prime and no greater than n; permutations of sides are not considered distinct.

Original entry on oeis.org

1, 1, 1, 1, 2, 2, 5, 7, 11, 12, 23, 25, 42, 48, 56, 65, 97, 103, 145, 157, 179, 194, 258, 270, 326, 351, 400, 425, 532, 544, 668, 719, 783, 828, 914, 941, 1121, 1180, 1271, 1316, 1541, 1571, 1821, 1902, 1998, 2085, 2387, 2442, 2705, 2787
Offset: 1

Views

Author

Vincent J. Matsko, Jun 27 2015

Keywords

Examples

			(1,1,1) is the only triangle up to n=4; (3,4,5) is added for n=5 and n=6.
		

Programs

  • Mathematica
    triangles[n_] := Module[{count = 0},
       For[a = 1, a <= n, a++,
        For[b = a, b <= n, b++,
         For[c = b, c <= n, c++,
          If[(a + b > c) && (b + c > a) && (c + a > b) && CoprimeQ[a, b, c],
           count++]]]];
       count];
    triangles[#] & /@ Range[50]
  • PARI
    a(n)=sum(a=3,n-2, sum(b=a+1,n-1, if(gcd(a,b)==1, sum(c=b+1,min(a+b-1,n), gcd(a*b,c)==1))))+1 \\ Charles R Greathouse IV, Jun 29 2015