

A135616


Number of permutations p of {1,2,...,n} such that p(x) is a polynomial in x, modulo n, of degree at most 2, for x=1,2,3,...,n.


1



1, 2, 6, 8, 20, 12, 42, 64, 162, 40, 110, 48, 156, 84, 120, 512, 272, 324, 342, 160, 252, 220, 506, 384, 2500, 312, 4374, 336, 812, 240, 930, 4096, 660, 544, 840, 1296, 1332, 684, 936, 1280
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

For n > 1, a(n) is a multiple of n less than n^3.  Charles R Greathouse IV, May 21 2015


LINKS

Table of n, a(n) for n=1..40.


EXAMPLE

For n=4, the permutation (1,2,3,4) is clearly given by the polynomial p(x)=x, for any modulus and the permutation (1,4,3,2) is found to be given by p(x)=2x^2+x+2 (modulo 4), since 2+1+2=5=1(mod 4), 2*4+2+2=12=0 (mod 4), 2*9+3+2=23=3 (mod 4) and 2*16+4+2=38=2 (mod 4). Among the other 22 permutations of (1,2,3,4) six are found to have the desired property, for a total of 8, so a(4)=8.


MATHEMATICA

f = Function[n, arg = Range[n]; Length[Union[Select[Flatten[ Table[Mod[a*arg^2 + b*arg + c, n], {a, n}, {b, n}, {c, n}], 2], Sort[#] == arg  1 &]]]]; Table[f[n], {n, 40}] (* Ivan Neretin, May 21 2015 *)


PROG

(PARI) a(n)=my(u=List(), v); for(a=1, n1, for(b=0, n1, v=vector(n, x, a*x^2+b*x)%n; if(#Set(v)==n, listput(u, v)))); for(a=1, n, v=vector(n, x, a*x%n); if(#Set(v)==n, listput(u, v))); n*#Set(u) \\ Charles R Greathouse IV, May 21 2015


CROSSREFS

Cf. A002618 (analog with linear polynomials).
Sequence in context: A124827 A140965 A002618 * A069553 A275826 A143481
Adjacent sequences: A135613 A135614 A135615 * A135617 A135618 A135619


KEYWORD

nonn


AUTHOR

John W. Layman, Feb 28 2008


EXTENSIONS

More terms from Ivan Neretin, May 21 2015


STATUS

approved



