cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A127697 Number of permutations of {1,2,...,n} where adjacent elements differ in value by 3 or more.

This page as a plain text file.
%I A127697 #22 Mar 10 2025 22:40:06
%S A127697 1,1,0,0,0,0,2,32,368,3984,44304,521606,6564318,88422296,1272704694,
%T A127697 19521035238,318120059458,5491779703870,100150978723568,
%U A127697 1924351621839740,38864316540425434,823161467837784388
%N A127697 Number of permutations of {1,2,...,n} where adjacent elements differ in value by 3 or more.
%C A127697 Equivalently, number of permutations of {1,2,...,n} where elements that differ by 1 in value are neither in positions i and i+1 (adjacent), nor i and i+2.
%H A127697 Robert P. P. McKone, <a href="/A127697/a127697_1.txt">The permutations n=6 to n=10.</a>
%e A127697 Valid permutations of {1,...,6} are 415263 and 362514.
%t A127697 Clear[permCount]; permCount[s_, last_] := permCount[s, last] = Module[{n, j}, n = Length[s]; If[n == 0, 1, Total[Table[If[Abs[last - j] >= 3, permCount[DeleteCases[s, j], j], 0], {j, s}]]]]; Table[permCount[Range[n], -2], {n, 0, 12}] (* _Robert P. P. McKone_, Mar 01 2025 *)
%Y A127697 Cf. A002464 (stride >= 2), A179957 (stride >= 4), A179958 (stride >=5).
%K A127697 nonn,more
%O A127697 0,7
%A A127697 Richard Forster (gbrl01(AT)yahoo.co.uk), Apr 11 2007, Apr 26 2007
%E A127697 Jul 01 2010: _Zak Seidov_ corrected a(10) and a(11). _R. H. Hardin_ then computed a(12) through a(18).
%E A127697 Corrected first term to 1 (was 0).
%E A127697 a(0), a(19)-a(20) from _Alois P. Heinz_, Oct 27 2014
%E A127697 a(21) from _Alois P. Heinz_, Feb 09 2025