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.

Showing 1-2 of 2 results.

A372218 a(n) is the number of ways to select three distinct points of an n X n grid forming a triangle whose sides do not pass through a grid point.

Original entry on oeis.org

0, 4, 36, 184, 592, 1828, 4164, 9360, 18592, 34948, 59636, 102096, 161496, 255700, 385292, 562336, 796344, 1131996, 1552780, 2133368, 2855632, 3765492, 4876444, 6328104, 8049744, 10203820, 12766508, 15870744, 19496392, 23984444, 29090340, 35318968, 42535496, 50936036
Offset: 0

Views

Author

Felix Huber, Apr 28 2024

Keywords

Comments

a(n) is 1/6 of the number of ways to select three points (x,y), (u,v), (p,q) with gcd(x-u,y-v) = gcd(u-p,v-q) = gcd(p-x,q-y) = 1 and 0 <= x, y, u, v, p, q <= n in an n X n grid.

Examples

			See the linked illustration: a(2) = 36 because there are 36 ways to select three distinct points in a square grid with side length n that satisfy the condition.
		

Crossrefs

Programs

  • Maple
    A372218:=proc(n)
      local x,y,u,v,p,q,a;
      a:=0;
      for x from 0 to n do
        for y from 0 to n do
          for u from 0 to n do
            for v from 0 to n do
              if gcd(x-u,y-v)=1 then
                for p from 0 to n do
                  for q from 0 to n do
                    if gcd(x-p,y-q)=1 and gcd(p-u,q-v)=1 then a:=a+1 fi;
                  od;
                od;
              fi;
            od;
          od;
        od;
      od;
      a:=a/6;
      return a;
    end proc;
    seq(A372218(n),n=0..33);

A372915 a(n) is the number of distinct triangles with area n whose vertices are points of an n X n grid.

Original entry on oeis.org

0, 0, 2, 4, 9, 10, 25, 22, 38, 49, 56, 56, 111, 71, 119, 141, 153, 126, 249, 166, 244, 299, 279, 244, 463, 288, 361, 489, 517, 373, 677, 436, 626, 719, 620, 665, 1078, 604, 811, 936, 1000, 749, 1444, 842, 1221, 1384, 1173, 1016, 1871, 1261, 1393, 1597, 1566, 1259
Offset: 0

Views

Author

Felix Huber, Jun 02 2024

Keywords

Examples

			See the linked illustration for the term a(4) = 9.
		

Crossrefs

Programs

  • Maple
    A372915:=proc(n)
      local p,q,g,h,u,v,x,y,L,M;
      L:=[];
      for g from 2 to n do
        h:=2*n/g;
        if type(h,integer) then
          for x to n do
            M:=[g,sqrt(x^2+h^2),sqrt((g-x)^2+h^2)];
            M:=sort(M);
            if not member(M,L) then
              L:=[op(L),M];
            fi;
          od;
        fi;
      od;
      for p to n do
        for q from 1 to p do
          g:=sqrt(p^2+q^2);
          h:=2*n/g;
          u:=h/g*q;
          v:=q+h/g*p;
          for x from max(1,ceil(p/q*(v-n)+u)) to min(n,floor(p/q*v+u)) do
            y:=q/p*(u-x)+v;
            if type(y,integer) and x <> p and y <> q then
              M:=[g,sqrt(x^2+(y-q)^2),sqrt((x-p)^2+y^2)];
              M:=sort(M);
              if not member(M,L) then
                L:=[op(L),M];
              fi;
            fi;
          od;
        od;
      od;
      return numelems(L);
    end proc;
    seq(A372915(n),n=0..53);
Showing 1-2 of 2 results.