|
|
A071268
|
|
Sum of all digit permutations of the concatenation of first n numbers.
|
|
4
|
|
|
1, 33, 1332, 66660, 3999960, 279999720, 22399997760, 2015999979840, 201599999798400, 927359999990726400, 1064447999999893555200, 2058376319999997941623680, 4439635199999999955603648000, 10585935359999999998941406464000, 27655756127999999999972344243872000
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
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.
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
|
|
LINKS
|
|
|
FORMULA
|
a(n) = (n + 1)!*(10^n - 1)/18 for 1 <= n <= 9.
|
|
EXAMPLE
|
For n=3, a(3) = 123 + 132 + 213 + 231 + 312 + 321 = 1332. - Michael B. Porter, Aug 28 2016
|
|
MAPLE
|
a:= proc(n) local s, t, l;
s:= cat("", seq(i, i=1..n)); t:= length(s);
l:= (p-> seq(coeff(p, x, i), i=0..9))(add(x^parse(s[i]), i=1..t));
(10^t-1)/9*combinat[multinomial](t, l)*add(i*l[i+1], i=1..9)/t
end:
|
|
MATHEMATICA
|
Table[Total@ Map[FromDigits, Permutations@ Flatten@ Map[IntegerDigits, Range@ n]], {n, 10}] (* or *)
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 *)
|
|
PROG
|
(PARI) A007908(n) = my(s=""); for(k=1, n, s=Str(s, k)); eval(s);
A047726(n) = n=eval(Vec(Str(n))); (#n)!/prod(i=0, 9, sum(j=1, #n, n[j]==i)!);
(Python)
from math import factorial
from operator import mul
from functools import reduce
s = ''.join(str(i) for i in range(1, n+1))
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
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|