login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A296530 Number of non-averaging permutations of [n] with first element n. 2
1, 1, 1, 1, 2, 2, 5, 10, 28, 24, 50, 124, 283, 528, 1266, 3715, 10702, 8740, 15414, 31988, 68465, 160964, 380124, 890738, 2230219, 3990852, 8354276, 20281732, 46056920, 131289988, 349369117, 1054037937, 3081527146, 2440225484, 4201202020, 7475926894, 13276918426 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,5
COMMENTS
A non-averaging permutation avoids any 3-term arithmetic progression.
a(0) = 1 by convention.
LINKS
Eric Weisstein's World of Mathematics, Nonaveraging Sequence
FORMULA
a(n) = A296529(n,n).
EXAMPLE
a(4) = 2: 4213, 4231.
a(5) = 2: 51324, 51342.
a(6) = 5: 621453, 624153, 624315, 624351, 624513.
a(7) = 10: 7312564, 7315264, 7315426, 7315462, 7315624, 7351264, 7351426, 7351462, 7351624, 7356124.
MAPLE
b:= proc(s) option remember; local n, r, ok, i, j, k;
if nops(s) = 1 then 1
else n, r:= max(s), 0;
for j in s minus {n} do ok, i, k:= true, j-1, j+1;
while ok and i>=0 and k<n do ok, i, k:=
not i in s xor k in s, i-1, k+1 od;
r:= r+ `if`(ok, b(s minus {j}), 0)
od; r
fi
end:
a:= n-> b({$0..n} minus {n-1}):
seq(a(n), n=0..30);
MATHEMATICA
b[s_] := b[s] = Module[{n = Max[s], r = 0, ok, i, j, k}, If[Length[s] == 1, 1, Do[{ok, i, k} = {True, j - 1, j + 1}; While[ok && i >= 0 && k < n, {ok, i, k} = {FreeQ[s, i] ~Xor~ MemberQ[s, k], i - 1, k + 1}]; r = r + If[ok, b[s ~Complement~ {j}], 0], {j, s ~Complement~ {n}}]; r]];
a[n_] := b[Complement[Range[0, n], {n - 1}]]
Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Jun 02 2018, from Maple *)
CROSSREFS
Main diagonal of A296529.
Sequence in context: A081374 A243338 A245306 * A117400 A005637 A233018
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Dec 14 2017
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 7 12:11 EDT 2024. Contains 372303 sequences. (Running on oeis4.)