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
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, n-1, for(b=0, n-1, 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
KEYWORD
nonn
AUTHOR
John W. Layman, Feb 28 2008
EXTENSIONS
More terms from Ivan Neretin, May 21 2015
STATUS
approved