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.
%I A332009 #18 Mar 30 2024 23:08:37 %S A332009 2,5,11,3,4,23,10,17,47,367,173,121,6,95,1431,3973,2513,331,191,567, %T A332009 1395,8011,391,761,8,383,8615,139897,78483,27201,21685,113,767,28073, %U A332009 715277,1298393,158189,1310499,40613,4049,10,1535,89311,1721203,9555617,37414903,27455053,7254087,582767,4549 %N A332009 Irregular triangle of numerators of the average value of the first letter over all derangements of {1, 2, ..., n} with k descents. %C A332009 Even-indexed rows have length n - 1; odd-indexed rows have length n - 2. %C A332009 Conjecture: T(n, 1) = A083329(n - 1). %C A332009 T(2n, 2n-1) = 2n, since the only derangement of 2n letters with 2n-1 descents is [2n, 2n-1,...,3,2,1]. %C A332009 The analogous sequence for permutations is T'(n, k) = k + 1. %e A332009 Triangle begins: %e A332009 2; %e A332009 5; %e A332009 11, 3, 4; %e A332009 23, 10, 17; %e A332009 47, 367, 173, 121, 6; %e A332009 95, 1431, 3973, 2513, 331; %e A332009 191, 567, 1395, 8011, 391, 761, 8. %e A332009 T(4,1) = 11 because the derangements of four letters with one descent are %e A332009 [2,3,4,1], [2,4,1,3], [3,4,1,2], and [4,1,2,3], and the expected value of the first letter is (2+2+3+4)/4 = 11/4, which has 11 as its numerator. %o A332009 (PARI) %o A332009 descents(p)={sum(i=2, #p, p[i]<p[i-1])} %o A332009 isderange(p)={for(i=1, #p, if(p[i]==i, return(0))); 1} %o A332009 qrow(n, f=numerator)={my(s=vector(n-n%2-1), d=vector(#s)); forperm(n, p, if(isderange(p), my(k=descents(p)); d[k]++; s[k]+=p[1])); vector(#s, k, f(s[k]/d[k]))} %o A332009 { for(n=2, 8, print(qrow(n, numerator))) } \\ _Andrew Howroyd_, Feb 02 2022 %Y A332009 Cf. A000166, A083329, A219836. %Y A332009 Denominators are given by A332010. %K A332009 nonn,tabf %O A332009 2,1 %A A332009 _Peter Kagey_, Feb 04 2020 %E A332009 Terms a(27) and beyond from _Andrew Howroyd_, Feb 02 2022