OFFSET
1,3
LINKS
Jean-François Alcover, Table of n, a(n) for n = 1..40
FORMULA
a(n) = n! - A006967(n).
EXAMPLE
a(3)=2 as only 123 and 321 have the required property, with differences of 1,1. The rest all have differences of 1,2.
MATHEMATICA
a[n_] := n! - A006967[[n+1]];
a /@ Range[40] (* Jean-François Alcover, Jan 31 2020 *)
PROG
(PARI) { for (n=3, 10, x=vector(n-1); s=0; for (i=1, n!, v=numtoperm(n, i); for (j=1, n-1, x[j]=abs(v[j+1]-v[j])); x=vecsort(x); fl=0; for (k=1, n-2, if (x[k]==x[k+1], fl=1; break)); if (fl==1, s++)); print(n"; "s)) }
CROSSREFS
KEYWORD
nonn
AUTHOR
Jon Perry, Jun 10 2003
STATUS
approved