## Description

The task is described in the title: find the sum of all numbers with the same digits(permutations) **including** duplicates. However, due to the fact that this is a performance edition kata, `num` can go up to `10**10000`. That's a number with 10001 digits(at most). Be sure to use efficient algorithms and good luck! All numbers tested for will be positive.

**Examples**
```
sum_arrangements(98) returns 89+98 = 187
sum_arrangements(123) returns 1332 #123 + 132 + 213 + 231 + 312 + 321 = 1332
sum_arrangements(1185) returns 99990 #1185 + 1158 + 1815 + 1851 + 1518 + 1581 + 1185 + 1158 + 1815 + 1851 + 1518 + 1581 + 8115 + 8151 + 8115 + 8151 + 8511 + 8511 + 5118 + 5181 + 5118 + 5181 + 5811 + 5811 = 99990
```

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Combinatorics

Starter code: def sum_arrangements(num):
	

Solutions:
from math import factorial as fact

def sum_arrangements(n):
	s = str(n)
	perms = fact(len(s) - 1)
	coefAll = int('1' * len(s))
	return coefAll * perms * sum(map(int, s))


def sum_arrangements(num):
	import math
	numLength = len(str(num))
	scaleFactor = int('1' * numLength) * math.factorial(numLength - 1)
	ans = 0
	for i in range(numLength):
		(num, digit) = divmod(num, 10)
		ans = ans + digit
	return ans * scaleFactor


from math import factorial

def sum_arrangements(n):
	s = str(n)
	return (10 ** len(s) - 1) // 9 * sum(map(int, s)) * factorial(len(s) - 1)


def sum_arrangements(num):
	num = str(num)
	n = 1
	number = len(num)
	for i in range(1, number):
		n *= i
	return int('1' * number) * sum((int(i) for i in num)) * n


from math import factorial

def sum_arrangements(num):
	return int(''.join(['1' for i in range(len(str(num)))])) * sum([int(i) for i in str(num)]) * factorial(len(str(num)) - 1)


from math import factorial

def sum_arrangements(num):
	return sum((int(_) for _ in str(num))) * factorial(len(str(num)) - 1) * int('1' * len(str(num)))


from math import factorial

def sum_arrangements(num):
	snum = str(num)
	leng = len(snum)
	total = 0
	c = factorial(leng - 1) * sum(map(int, snum))
	for i in range(leng):
		total += c
		c *= 10
	return total


from math import factorial

def sum_arrangements(num):
	ns = list(map(int, str(num)))
	mul = factorial(len(ns) - 1)
	return int('1' * len(ns)) * sum(ns) * mul


def sum_arrangements(num):
	s = str(num)
	from math import factorial
	return factorial(len(s) - 1) * int('1' * len(s)) * sum((int(i) for i in s))


import itertools, math

def sum_arrangements(num):
	return math.factorial(len(str(num)) - 1) * int('1' * len(str(num))) * sum((int(i) for i in str(num)))