## Your Job

  Find the sum of all multiples of `n` below `m` 
  
  
## Keep in Mind

  * `n` and `m` are natural numbers (positive integers)
  * `m` is **excluded** from the multiples
  
  
## Examples

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def sum_mul(n, m):
	

Solutions:
def sum_mul(n, m):
	if m > 0 and n > 0:
		return sum(range(n, m, n))
	else:
		return 'INVALID'


def sum_mul(n, m):
	return sum((x for x in range(n, m, n))) if m > 0 and n > 0 else 'INVALID'


xrange = range

def sum_mul(n, m):
	if m <= 0 or n <= 0:
		return 'INVALID'
	k = (m - 1) // n
	return (k + 1) * k // 2 * n


sum_mul = lambda n, m: sum(range(n, m, n)) if n > 0 and m > 0 else 'INVALID'


def sum_range(end, divisor=None):
	if divisor:
		return int(sum_range(end // divisor)) * divisor
	return end * (end + 1) / 2

def sum_mul(n, m):
	return sum_range(m - 1, divisor=n) if n > 0 and m > 0 else 'INVALID'


def sum_mul(n, m):
	sumu = 0
	if n > 0 and m > 0:
		for i in range(n, m):
			if i % n == 0:
				sumu += i
	else:
		return 'INVALID'
	return sumu


def sum_mul(n, m):
	L = []
	if n <= 0 or m <= 0:
		return 'INVALID'
	else:
		for i in range(0, m):
			if i * n < m:
				L.append(i * n)
		return sum(L)


xrange = range

def sum_mul(n, m):
	if m <= 0 or n <= 0:
		return 'INVALID'
	return sum((x for x in range(m) if x % n == 0))


from typing import Union

def sum_mul(n: int, m: int) -> Union[int, str]:
	return 'INVALID' if any(map(lambda _: _ <= 0, [n, m])) else sum([_ for _ in range(m)][::n])


def sum_mul(n, m):
	s = n > 0 and sum([i for i in range(n, m, n)])
	return ['INVALID', s][n > 0 and m > 0]


def sum_mul(n, m):
	if n > 0 and m > 0:
		k = max(m // n - (not m % n), 0)
		return n * k * (k + 1) // 2
	return 'INVALID'


def sum_mul(n, m):
	return sum([i for i in range(m) if not i % n]) if m > 0 < n else 'INVALID'


sum_mul = lambda n, m: 'INVALID' if n <= 0 or m <= 0 else sum((x for x in range(m) if x % n == 0))


def sum_mul(n, m):
	if n <= 0 or m <= 0:
		return 'INVALID'
	else:
		s = 0
		for i in range(1, m):
			j = i * n
			if j < m:
				s += j
	return s


def sum_mul(n, m):
	if n <= 0 or m <= 0:
		return 'INVALID'
	else:
		return sum([i for i in range(1, m) if i % n == 0])


def sum_mul(n, m):
	if n < 1 or m < 1:
		return 'INVALID'
	multiples_sum = 0
	for num in range(n, m, n):
		multiples_sum += num
	return multiples_sum


def sum_mul(n, m):
	print((n, m))
	try:
		return 'INVALID' if n < 1 or m < 1 else sum(range(n, m, n))
	except:
		return 'INVALID'


def sum_mul(n, m):
	if m < 1 or n < 1:
		return 'INVALID'
	else:
		grandtotal = []
		subtotal = 0
		for i in range(1, m):
			if i % n == 0:
				subtotal = subtotal + i
				grandtotal.append(i)
		return sum(grandtotal)


def sum_mul(n, m):
	return sum((el for el in range(n, m, n))) if n > 0 < m else 'INVALID'


def sum_mul(n, m):
	result = 0
	if n > 0 < m:
		try:
			for num in range(n, m, n):
				result += num
			return result
		except:
			return 'INVALID'
	else:
		return 'INVALID'


def sum_mul(n, m):
	return sum(range(n, m, n)) if not (n <= 0 or m <= 0) else 'INVALID'


def sum_mul(n, m):
	print((n, m))
	if m <= 0 or n <= 0:
		return 'INVALID'
	return sum(range(n, m, n))


def sum_mul(n, m):
	print(n, m)
	if n <= 0 or m <= 0:
		return 'INVALID'
	return sum((i for i in range(m) if i % n == 0))


def sum_mul(n, m):
	print(n)
	print(m)
	if n <= 0:
		return 'INVALID'
	elif m <= 0:
		return 'INVALID'
	if n == m:
		return 0
	res = 0
	j = n
	for i in range(n, m, j):
		res += i
	return res


def sum_mul(n, m):
	if n > 0 and m > 0:
		i = 1
		ergebnis = 0
		for i in range(n, m, n):
			ergebnis += i
		return ergebnis
	else:
		return 'INVALID'


def sum_mul(n, m):
	if n < 1 or m < 1:
		return 'INVALID'
	else:
		return sum((n * i for i in range(m // n + 1))) if m % n != 0 else sum((n * i for i in range(m // n)))
	(2, 4, 6, 8)


def sum_mul(n, m):
	sum = 0
	for i in range(1, m):
		try:
			if i % n == 0 and m > 0 and (n > 0):
				sum += i
		except ZeroDivisionError:
			continue
	return sum if n > 0 and m > 0 else 'INVALID'


def sum_mul(n, m):
	try:
		return sum((i for i in range(n, m, n))) if n > 0 < m else 'INVALID'
	except:
		return 'INVALID'


def sum_mul(n, m):
	if n <= 0 or m <= 0:
		return 'INVALID'
	try:
		return sum(range(n, m, n))
	except:
		return 'INVALID'


def sum_mul(n, m):
	if m <= 0 or n <= 0:
		return 'INVALID'
	elif n > m:
		return 0
	else:
		suma = 0
		for i in range(0, m, n):
			suma = suma + i
		return suma


def sum_mul(n, m):
	result = 0
	if m <= 0 or n <= 0:
		return 'INVALID'
	elif n > m or m == n:
		return 0
	for i in range(n, m, n):
		result += i
	return result


def sum_mul(n, m):
	if n <= 0 or m <= 0:
		return 'INVALID'
	return (m - 1) // n * (1 + (m - 1) // n) * n // 2


def sum_mul(n, m):
	if n <= 0 or m <= 0:
		return 'INVALID'
	else:
		total = 0
		for i in range(m):
			if i % n == 0:
				total += i
		return total


def sum_mul(n, m):
	if n <= 0 or m <= 0:
		return 'INVALID'
	elif n <= m:
		return sum(range(n, m, n))
	elif n > m:
		return 0


import math

def sum_mul(n, m):
	if n <= 0 or m <= 0:
		return 'INVALID'
	else:
		total = 0
		howMany = math.floor(m / n)
		print(howMany)
		if m % n == 0:
			for i in range(howMany - 1):
				total = total + n * (i + 1)
		else:
			for i in range(howMany):
				total = total + n * (i + 1)
		return total
	pass


def sum_mul(n, m):
	if n <= 0 or 0 >= m:
		return 'INVALID'
	elif n > m:
		return 0
	else:
		c = 0
		x = 1
		while x * n < m:
			c += x * n
			x += 1
		return c


def sum_mul(n, m):
	ctr = 0
	if m <= 0 or n <= 0:
		return 'INVALID'
	for i in range(1, m):
		if i % n == 0:
			ctr += i
	return ctr


def sum_mul(n, m):
	if n < 1 or m < 1:
		return 'INVALID'
	s = 0
	x = n
	while x < m:
		s += x
		x += n
	else:
		return s
		return 0


import math

def sum_mul(n, m):
	if n <= 0 or m <= 0:
		return 'INVALID'
	s = 0
	i = n
	while i < m:
		s += i
		i += n
	return s


from math import floor

def sum_mul(n, m):
	print([n, m], flush=True)
	if n > 0 and m > 0:
		i = 1
		sum = 0
		while i * n < m:
			sum += i * n
			i += 1
		return sum
	else:
		return 'INVALID'


def sum_mul(n, m):
	if n <= 0:
		return 'INVALID'
	if m <= 0:
		return 'INVALID'
	if n == m:
		return 0
	number_multiples = (m - 1) // n
	total = number_multiples * (number_multiples + 1) // 2
	return_value = total * n
	return return_value


def sum_mul(n, m):
	sum = 0
	counter = 0
	if m <= 0 or n <= 0:
		return 'INVALID'
	while counter < m:
		sum += counter
		counter += n
	return sum


def sum_mul(n, m):
	if n <= 0 or m <= 0:
		return 'INVALID'
	arr = [a * n for a in range(1, m) if a < m / n]
	return sum(arr)


def sum_mul(n, m):
	sum = 0
	inc = n
	if n > 0 and m > 0:
		while n < m:
			sum += n
			n += inc
		return sum
	else:
		return 'INVALID'


def sum_mul(n, m):
	if n <= 0 or m <= 0:
		return 'INVALID'
	elif n == m:
		return 0
	s = 0
	for i in range(1, m // n + 1):
		if n * i < m:
			s += n * i
		else:
			break
	return s


def sum_mul(n, m):
	total = 0
	if n <= 0 or m <= 0:
		return 'INVALID'
	try:
		for n in range(n, m, n):
			total += n
		return total
	except:
		return 'INVALID'


def sum_mul(n, m):
	return 'INVALID' if n < 1 or m < 1 else sum([x for x in range(n, m, n)])


def sum_mul(n, m):
	if n > 0 and m > 0:
		a = (m - 1) // n
		b = a * (a + 1)
		c = n - 2
		return b + c * (b / 2)
	return 'INVALID'


def sum_mul(n, m):
	print(m, n)
	if m <= 0 or n <= 0:
		return 'INVALID'
	else:
		a = list(range(n, m, n))
		return sum(a)


def sum_mul(n, m):
	if n <= 0 or m <= 0:
		return 'INVALID'
	else:
		new_arr = []
		for num in range(n, m, n):
			new_arr.append(num)
		return sum(new_arr)


def sum_mul(n, m):
	if n <= 0 or m <= 0:
		return 'INVALID'
	elif n >= m:
		return 0
	else:
		mult = 1
		i = 1
		n_mult = 0
		while mult <= m:
			mult = i * n
			if mult >= m:
				return n_mult
			n_mult += mult
			i += 1
		return n_mult


def sum_mul(n, m):
	print(f'n: {n}, m: {m}')
	return sum(range(n, m, n * (1, -1)[m < 0])) if n > 0 and m > 0 else 'INVALID'


def sum_mul(n, m):
	print(n)
	print(m)
	numbers = list()
	if m <= 0 or n <= 0:
		return 'INVALID'
	if n > m:
		return 0
	if m < n:
		return 'INVALID'
	i = 1
	while i < m:
		if n * i < m:
			numbers.append(n * i)
			i = i + 1
		else:
			break
	return sum(numbers)


def sum_mul(n, m):
	sum_n = 'INVALID'
	if n > 0 and m > 0:
		sum_n = sum(range(n, m, n))
	return sum_n


def sum_mul(n, m):
	sum_n = 'INVALID'
	if n > 0 and m > 0:
		num = (m - 1) // n
		sum_n = n * num * (num + 1) // 2
	return sum_n


def sum_mul(n, m):
	if n <= 0 or m <= 0:
		return 'INVALID'
	a = 0
	b = []
	while a + n < m:
		a += n
		b.append(a)
	return sum(b)


def sum_mul(n, m):
	lst = [x for x in range(n, m)]
	a = 1
	new = []
	for i in range(len(lst)):
		new.append(n * a)
		a += 1
	final = []
	for i in new:
		if i < m:
			final.append(i)
	if n <= 0 or m <= 0:
		return 'INVALID'
	else:
		return sum(final)


def sum_mul(n, m):
	if n <= 0 or m <= 0:
		return 'INVALID'
	try:
		ans = [i for i in range(n, m) if i % n == 0]
		return sum(ans)
	except:
		return 'INVALID'


def sum_mul(n, m):
	total = 0
	while n > 0 and m > 0:
		for i in range(m):
			if abs(i) % n == 0:
				total += i
		return total
	return 'INVALID'