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.

A139365 Array of digit sums of factorial representation of numbers 0,1,...,n!-1 for n >= 1.

This page as a plain text file.
%I A139365 #50 Jan 20 2025 14:13:52
%S A139365 0,0,0,1,0,1,1,2,2,3,0,1,1,2,2,3,1,2,2,3,3,4,2,3,3,4,4,5,3,4,4,5,5,6,
%T A139365 0,1,1,2,2,3,1,2,2,3,3,4,2,3,3,4,4,5,3,4,4,5,5,6,1,2,2,3,3,4,2,3,3,4,
%U A139365 4,5,3,4,4,5,5,6,4,5,5,6,6,7,2,3,3,4,4,5,3,4,4,5,5,6,4,5,5,6,6,7,5,6,6,7,7
%N A139365 Array of digit sums of factorial representation of numbers 0,1,...,n!-1 for n >= 1.
%C A139365 The row lengths sequence is A000142 (factorials).
%C A139365 When the factorial representation is read as (D. N.) Lehmer code for permutations of n objects then the digit sums in row n count the inversions of the permutations arranged in lexicographic order.
%C A139365 Row n is the first n! terms of A034968. - _Franklin T. Adams-Watters_, May 13 2009
%H A139365 Alois P. Heinz, <a href="/A139365/b139365.txt">Rows n = 0..8, flattened</a>
%H A139365 FindStat - Combinatorial Statistic Finder, <a href="http://www.findstat.org/St000018">The number of inversions of a permutation </a>
%H A139365 A. Kohnert, <a href="ftp://ftp.mathe2.uni-bayreuth.de/axel/combalg/combalg.ps"> Kombinatorische Algorithmen in C, Skript, Uni Bayreuth, 1997, pp. 5-7 </a> [Broken link]
%H A139365 Wolfdieter Lang, <a href="/A139365/a139365.txt">First 6 rows. Factorial representations or Lehmer code for permutations</a>.
%H A139365 D. N. Lehmer, <a href="http://dx.doi.org/10.1090/S0002-9904-1906-01419-7">On the orderly listing of substitutions</a>, Bull. AMS 12 (1906), 81-84.
%H A139365 <a href="/index/Fa#facbase">Index entries for sequences related to factorial base representation</a>
%F A139365 Row n >= 1: sum(facrep(n,m)[n-j],j=1..n), m=0,1,...,n!-1, with the factorial representation facrep(n,m) of m for given n.
%F A139365 T(n,n!-1) = A161680(n). - _Alois P. Heinz_, Jan 20 2025
%e A139365 n=3: The Lehmer codes for the permutations of {1,2,3} are [0,0,0], [0,1,0], [1,0,0], [1,1,0], [2,0,0] and [2,1,0]. These are the factorial representations for 0,1,...,5=3!-1. Therefore row n=3 has the digit sums 0,1,1,2,2,3, the number of inversions of the permutations [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2] and [3,2,1] (lexicographic order).
%e A139365 Triangle begins:
%e A139365   0;
%e A139365   0;
%e A139365   0, 1;
%e A139365   0, 1, 1, 2, 2, 3;
%e A139365   0, 1, 1, 2, 2, 3, 1, 2, 2, 3, 3, 4, 2, 3, 3, 4, 4, 5, 3, 4, 4, 5, 5, 6;
%e A139365   ...
%t A139365 nn = 5; m = 1; While[Factorial@ m < nn! - 1, m++]; m; Table[Total@ IntegerDigits[k, MixedRadix[Reverse@ Range[2, m]]], {n, 0, 5}, {k, 0, n! - 1}] // Flatten (* Version 10.2, or *)
%t A139365 f[n_] := Block[{a = {{0, n}}}, Do[AppendTo[a, {First@ #, Last@ #} &@ QuotientRemainder[a[[-1, -1]], Times @@ Range[# - i]]], {i, 0, #}] &@ NestWhile[# + 1 &, 0, Times @@ Range[# + 1] <= n &]; Most@ Rest[a][[All, 1]]]; Table[Total@ f@ k, {n, 0, 5}, {k, 0, n! - 1}] // Flatten (* _Michael De Vlieger_, Aug 29 2016 *)
%Y A139365 Cf. A034968. - _Franklin T. Adams-Watters_, May 13 2009
%Y A139365 Cf. A008302.
%Y A139365 Cf. A000142, A161680.
%Y A139365 Row sums give A001809.
%K A139365 nonn,base,easy,tabf
%O A139365 0,8
%A A139365 _Wolfdieter Lang_, May 21 2008
%E A139365 Zeroth row added by _Franklin T. Adams-Watters_, May 13 2009