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.

A072949 Number of permutations p of {1,2,3,...,n} such that Sum_{k=1..n} abs(k-p(k)) = 2n.

This page as a plain text file.
%I A072949 #42 Jan 15 2025 04:17:21
%S A072949 1,0,0,0,4,24,148,744,3696,17640,83420,390144,1817652,8438664,
%T A072949 39117852,181136304,838372452,3879505944,17952463180,83086702848,
%U A072949 384626048292,1781018204328,8249656925564,38225193868560,177179811427796,821544012667704,3810648054607212
%N A072949 Number of permutations p of {1,2,3,...,n} such that Sum_{k=1..n} abs(k-p(k)) = 2n.
%C A072949 a(n) is always even for n>=1. More generally, A062869(n,k) is even whenever k >= n. - Conjectured by _Franklin T. Adams-Watters_, proved by _Max Alekseyev_. (see link in A062869)
%H A072949 Seiichi Manyama, <a href="/A072949/b072949.txt">Table of n, a(n) for n = 0..500</a> (terms 0..50 from Alois P. Heinz)
%H A072949 Mathieu Guay-Paquey and T. Kyle Petersen, <a href="http://arxiv.org/abs/1404.4674">The generating function for total displacement</a>, arXiv:1404.4674 [math.CO], 2014.
%p A072949 with(linalg): f := (i,j) -> x^(abs(i-j)):for n from 1 to 17 do A := matrix(n,n,f): printf("%d,",coeff(permanent(A),x,2*n)) od: # Herman Jamke (hermanjamke(AT)fastmail.fm), Apr 27 2008
%t A072949 g[h_, n_] := g[h, n] = Module[{i, j}, {i, j} = QuotientRemainder[h, 2]; 1 - If[h==n, 0, (i+1)*z*t^(i+j)/g[h+1, n]]]; a[n_ /; n<4] = 0; a[n_] := SeriesCoefficient[1/g[0, n], {z, 0, n}, {t, 0, n}]; Table[an = a[n]; Print["a(", n, ") = ", an]; an, {n, 1, 26}] (* _Jean-François Alcover_, Jan 07 2016, after _Alois P. Heinz_ *)
%o A072949 (PARI) a(n)=sum(k=1,n!,if(sum(i=1,n,abs(i-component(numtoperm(n,k),i)))-2*n,0,1))
%Y A072949 Cf. A072948, A062869.
%K A072949 nonn
%O A072949 0,5
%A A072949 _Benoit Cloitre_, Aug 20 2002
%E A072949 More terms from Herman Jamke (hermanjamke(AT)fastmail.fm), Apr 27 2008
%E A072949 a(18)-a(21) from _Robert Gerbicz_, Nov 21 2010
%E A072949 a(22)-a(26) from _Alois P. Heinz_, May 02 2014 using formula given by Guay-Paquey and Petersen
%E A072949 a(0)=1 prepended by _Alois P. Heinz_, Oct 01 2022