login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Sum of all digit permutations of the concatenation of first n numbers.
4

%I #58 Mar 26 2020 11:13:59

%S 1,33,1332,66660,3999960,279999720,22399997760,2015999979840,

%T 201599999798400,927359999990726400,1064447999999893555200,

%U 2058376319999997941623680,4439635199999999955603648000,10585935359999999998941406464000,27655756127999999999972344243872000

%N Sum of all digit permutations of the concatenation of first n numbers.

%C The permutations yield n! different numbers and if they are stacked vertically then the sum of each column is (n-1)! times the n-th triangular number = (n-1)!*n(n+1)/2. a(n) = [(n+1)!/2]*[{10^n -1}/9]. Note that this is only valid for 1 <= n <= 9.

%C The first person who studied the sum of different permutations of digits of a given number seems to be the French scientist Eugène Aristide Marre (1823-1918). See links. - _Bernard Schott_, Dec 07 2012

%H Alois P. Heinz, <a href="/A071268/b071268.txt">Table of n, a(n) for n = 1..208</a>, Jan 04 2019

%H A. Marre, <a href="http://archive.numdam.org/item/NAM_1846_1_5__57_1/">Trouver la somme de toutes les permutations différentes d'un nombre donné.</a>, Nouvelles Annales de Mathématiques, 1ère série, tome 5 (1846), p. 57-60.

%H Norbert Verdier and Raymond Cordier, <a href="http://www.les-mathematiques.net/phorum/read.php?17,777265">QDV4 : Marre, Marre et Marre, page=1</a> (French mathematical forum les-mathematiques.net)

%F a(n) = (n + 1)!*(10^n - 1)/18 for 1 <= n <= 9.

%F a(n) = ((10^A055642(A007908(n))-1)/9)*(A047726(A007908(n))*A007953(A007908(n))/(A055642(A007908(n)))). - _Altug Alkan_, Aug 28 2016

%e For n=3, a(3) = 123 + 132 + 213 + 231 + 312 + 321 = 1332. - _Michael B. Porter_, Aug 28 2016

%p a:= proc(n) local s, t, l;

%p s:= cat("", seq(i, i=1..n)); t:= length(s);

%p l:= (p-> seq(coeff(p, x, i), i=0..9))(add(x^parse(s[i]), i=1..t));

%p (10^t-1)/9*combinat[multinomial](t, l)*add(i*l[i+1], i=1..9)/t

%p end:

%p seq(a(n), n=1..20); # _Alois P. Heinz_, Jan 04 2019

%t Table[Total@ Map[FromDigits, Permutations@ Flatten@ Map[IntegerDigits, Range@ n]], {n, 10}] (* or *)

%t Table[Function[d, (((10^Length@ d - 1)/9)* Length@ Union@ Map[FromDigits, Permutations@ d] Total[d])/Length@ d]@ Flatten@ Map[IntegerDigits, Range@ n], {n, 11}] (* _Michael De Vlieger_, Aug 30 2016, latter after _Harvey P. Dale_ at A047726 *)

%o (PARI) A007908(n) = my(s=""); for(k=1, n, s=Str(s, k)); eval(s);

%o A047726(n) = n=eval(Vec(Str(n))); (#n)!/prod(i=0, 9, sum(j=1, #n, n[j]==i)!);

%o A055642(n) = #Str(n);

%o A007953(n) = sumdigits(n);

%o a(n) = ((10^A055642(A007908(n))-1)/9)*(A047726(A007908(n))*A007953(A007908(n))/(A055642(A007908(n)))); \\ _Altug Alkan_, Aug 28 2016

%o (Python)

%o from math import factorial

%o from operator import mul

%o from functools import reduce

%o def A071268(n):

%o s = ''.join(str(i) for i in range(1,n+1))

%o return sum(int(d) for d in s)*factorial(len(s)-1)*(10**len(s)-1)//(9*reduce(mul,(factorial(d) for d in (s.count(w) for w in set(s))))) # _Chai Wah Wu_, Jan 04 2019

%Y Cf. A045876, A047726, A007908.

%K base,nonn

%O 1,2

%A _Amarnath Murthy_, Jun 01 2002

%E Edited by _Robert G. Wilson v_, Jun 03 2002

%E Corrected by _Altug Alkan_, Aug 28 2016