The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A296531 Number of non-averaging permutations of [n] with first element ceiling(n/2). 2

%I #17 Jun 02 2018 10:38:12

%S 1,1,1,2,3,6,13,32,51,76,161,386,903,2280,5018,12828,19720,27656,

%T 48788,100120,220686,537208,1258242,3123166,7056165,17189752,35968308,

%U 82137764,189847917,509880208,1322092262,3807727932,5678509066,7721623440,13293899416,23650787296

%N Number of non-averaging permutations of [n] with first element ceiling(n/2).

%C A non-averaging permutation avoids any 3-term arithmetic progression.

%C a(0) = 1 by convention.

%H Alois P. Heinz, <a href="/A296531/b296531.txt">Table of n, a(n) for n = 0..99</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/NonaveragingSequence.html">Nonaveraging Sequence</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Arithmetic_progression">Arithmetic progression</a>

%H <a href="/index/No#non_averaging">Index entries related to non-averaging sequences</a>

%F a(n) = A296529(n,ceiling(n/2)).

%e a(5) = 6: 31254, 31524, 31542, 35124, 35142, 35412.

%e a(6) = 13: 312564, 315264, 315426, 315462, 315624, 351264, 351426, 351462, 351624, 354126, 354162, 354612, 356124.

%p b:= proc(s) option remember; local n, r, ok, i, j, k;

%p if nops(s) = 1 then 1

%p else n, r:= max(s), 0;

%p for j in s minus {n} do ok, i, k:= true, j-1, j+1;

%p while ok and i>=0 and k<n do ok, i, k:=

%p not i in s xor k in s, i-1, k+1 od;

%p r:= r+ `if`(ok, b(s minus {j}), 0)

%p od; r

%p fi

%p end:

%p a:= n-> b({$0..n} minus {ceil(n/2)-1}):

%p seq(a(n), n=0..25);

%t 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]];

%t a[n_] := b[Complement[Range[0, n], {Ceiling[n/2] - 1}]];

%t Table[a[n], {n, 0, 25}] (* _Jean-François Alcover_, Jun 02 2018, from Maple *)

%Y Cf. A003407, A292523, A296529.

%K nonn

%O 0,4

%A _Alois P. Heinz_, Dec 14 2017

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 June 6 09:58 EDT 2024. Contains 373126 sequences. (Running on oeis4.)