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.

A189346 Number of sets of four points on an n X n grid (or geoboard), exactly three of which are collinear.

Original entry on oeis.org

0, 0, 48, 532, 3088, 11340, 33824, 83288, 183344, 364304, 681872, 1194100, 1992976, 3182332, 4941360, 7420640, 10874720, 15539952, 21812720, 30011924, 40650368, 54187196, 71463440, 92990296, 119675712, 152314920, 192393872, 240690060
Offset: 1

Views

Author

Martin Renner, Apr 20 2011

Keywords

Comments

The four points build a triangle on an n X n grid, with one of them located on a side of the triangle.
The number of sets of four points with the three collinear points in a horizontal or vertical line is 2*n^2*(n-1)*binomial(n,3) = 4*A090448(n). The number of sets of four points with the three collinear points in a diagonal line of slope 1 is 2*n*(n-1)*binomial(n,3) + 4*Sum_{k=3..n-1}(n^2-k)*binomial(k,3). The sum of these two values is a lower bound for this sequence. - Nathaniel Johnston, Apr 23 2011

Crossrefs

Programs

  • Maple
    A189346 := proc(n)local a,b,j,k,l,m,s,slopes,num,den,tot: tot := 0: slopes := {}: for b from 1 to ceil(n/2)-1 do for a from 0 to b do slopes := slopes union {a/b}: od: od: for s from 1 to nops(slopes) do num := numer(slopes[s]): den := denom(slopes[s]): if(num = 0)then tot := tot + 2*n^2*(n-1)*binomial(n,3): elif(num = den)then tot := tot + 2*(2*add(binomial(k,3)*(n^2-k), k=3..n) - binomial(n,3)*(n^2 - n)): else for j from 1 to n - 2*den do for k from 1 to n - 2*num do tot := tot + 4*(n^2 - 3): for l from 1 to n do for m from 1 to n do if((not l = j or not m = k) and (not l = j + den or not m = k + num) and (not l = j + 2*den or not m = k + 2*num) and (m - k)*den = num*(l - j))then tot := tot - 4: fi: od: od: od: od: fi: od: return tot: end:
    seq(A189346(n),n=1..15); # Nathaniel Johnston, Apr 23 2011

Extensions

a(6)-a(28) from Nathaniel Johnston, Apr 23 2011