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.

A135538 Number of triples in all permutations of order n that are collinear modulo n.

Original entry on oeis.org

0, 0, 0, 6, 32, 400, 2304, 35280, 322560, 3888000, 48384000, 731808000, 9858723840, 161902540800, 2628760780800, 43181994240000, 876764528640000, 16124496740352000, 358721232629760000, 6933770723303424000, 168738115888742400000, 3644128675321085952000, 94201965756599500800000
Offset: 0

Views

Author

R. J. Mathar, Feb 22 2008, corrected Oct 24 2008

Keywords

Examples

			For example, in a permutation p=[5,2,4,3,1], a triple of points { (2,p(2)=2), (4,p(4)=3), (5,p(5)=1) } is collinear, since they are located on the line: x + 3*y == 3 (mod 5).
		

Programs

  • Mathematica
    f[n_] := n*Sum[ Sum[ (n - i - j)*( n*GCD[i, j, n - i - j] - GCD[i, n] - GCD[j, n] - GCD[i + j, n] + 2 ) , {j, 1, n - i}] , {i, 1, n}]; Join[{0, 0, 0}, Table[(n - 3)!*f[n], {n, 3, 25}]] (* G. C. Greubel, Oct 18 2016 *)
  • PARI
    a(n) = if(n<3, 0, (n-3)! * n * sum(i=1,n, sum(j=1,n-i-1, (n-i-j) * (n*gcd([i,j,n-i-j]) - gcd(i,n) - gcd(j,n) - gcd(i+j,n) + 2) )))

Formula

For n>=3, a(n) = (n-3)! * A146557(n).

Extensions

Edited and extended by Max Alekseyev, Oct 31 2008

A146558 Number of order n permutations without collinear triples modulo n.

Original entry on oeis.org

1, 2, 0, 16, 0, 72, 0, 256, 0, 0, 0, 2304, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Max Alekseyev, Nov 01 2008

Keywords

Examples

			For n=4, there are a(4)=16 permutations without collinear triples: [1, 2, 4, 3], [1, 3, 2, 4], [1, 3, 4, 2], [1, 4, 2, 3], [2, 1, 3, 4], [2, 3, 1, 4], [2, 4, 1, 3], [2, 4, 3, 1], [3, 1, 2, 4], [3, 1, 4, 2], [3, 2, 4, 1], [3, 4, 2, 1], [4, 1, 3, 2], [4, 2, 1, 3], [4, 2, 3, 1], [4, 3, 1, 2]
		

Crossrefs

Programs

  • PARI
    { a(n) = local(p,r,g); r=0; for(j=1,n!, p=numtoperm(n,j); g=1; forvec(v=vector(3,i,[1,n]), if(matdet([1,v[1],p[v[1]];1,v[2],p[v[2]];1,v[3],p[v[3]]])%n==0, g=0; break), 2); if(g,r++)); r }

Formula

For prime p>=3, a(p) = 0.

Extensions

Edited by Max Alekseyev, Jun 21 2010
a(14)-a(29) from Bert Dobbelaere, Mar 15 2020
Showing 1-2 of 2 results.