## Problem

Determine whether a positive integer number is **colorful** or not.

`263` is a colorful number because `[2, 6, 3, 2*6, 6*3, 2*6*3]` are all different; whereas `236` is not colorful, because `[2, 3, 6, 2*3, 3*6, 2*3*6]` have `6` twice.

So take all consecutive subsets of digits, take their product and ensure all the products are different.

## Examples
```pyhton
263  -->  true
236  -->  false
```

Difficulty: introductory

Starter code:

def colorful(number):
	

Solutions:
def colorful(number):
    base_result = []
    for x in str(number):
        base_result.append(int(x))
    for y in range(len(base_result) - 1):
        temp = base_result[y] * base_result[y + 1]
        base_result.append(temp)
    # Should you really eval the last value ? :shrug: If so, would use eval
    return len(set(base_result)) == len(base_result)

from functools import reduce
from collections import Counter

def colorful(n):
    s = list(map(int,str(n)))
    cnt = Counter( reduce(int.__mul__, s[i:i+x]) for x in range(1,len(s)+1) for i in range(len(s)-x+1))
    return cnt.most_common(1)[0][1] == 1

from functools import reduce


def colorful(n):
    ld = [int(d) for d in str(n)]
    l = len(ld)
    p = [reduce(int.__mul__, ld[i:i+k]) for k in range(1, l+1) for i in range(l-k+1)]
    return len(p) == len(set(p))


REGEX = __import__("re").compile(
    r"(.).*\1" # Duplicate digit
    r"|[01].+|.+[01]" # 0 or 1 and another digit
    r"|(23|32).*6|6.*(23|32)" # 2*3 and a 6 before or after
    r"|(24|42).*8|8.*(24|42)" # 2*4 and a 8 before or after
    r"|(26|62).*(34|43)|(34|43).*(26|62)" # 2*6 and 3*4 before or after
    r"|(29|92).*(36|63)|(36|63).*(29|92)" # 2*9 and 3*6 before or after
    r"|(38|83).*(46|64)|(46|64).*(38|83)" # 3*8 and 4*6 before or after
    r"|(49|94).*(236|263|326|362|623|632)|(236|263|326|362|623|632).*(49|94)" # 4*9 and 2*3*6 before or after
    r"|(89|98).*(346|364|436|463|634|643)|(346|364|436|463|634|643).*(89|98)" # 8*9 and 3*4*6 before or after
).search

def colorful(number):
    return not REGEX(str(number))

def colorful(number):
    lst = [int(d) for d in str(number)]
    
    if number > 9:
        # no need to compute : if 1 ==> previous * 1 == previous, if 0 ==> previous * 0 == 0
        if 0 in lst or 1 in lst:
            return False
            
        all, previous = lst, -1
        for digit in str(number):
            # not the first time
            if previous != -1:
                lst.append(int(digit) * previous)
            previous = int(digit)
        
        # if 1 or 2 digits : multiplication of all numbers is already added to the list
        if number > 99:
            total = 1
            for d in all:
                total *= d
            lst.append(total)
        
    return len(lst) == len(set(lst))

def colorful(number):
    if len(str(number)) == 1: 
        return True
    else:
        output = list(str(number))
        for n,x in enumerate(list(str(number))):
            if n + 1 < len(str(number)):
                tmp = list(str(number))[n+1]
                
                #tmp = int()
                output.append(str(int(x) * int(tmp)))
       
        if len(output) == len(set(output)):
            return True
        else:
            return False    
            
      


from functools import reduce
from operator import mul

def colorful(number):
    digits = [int(d) for d in str(number)]
    prods = []
    
    for size in range(1, len(digits) +1):
        for start in range(len(digits)-size +1):
            prods.append(reduce(mul, digits[start : start+size]))
    
    return len(prods) == len(set(prods))

from functools import reduce

def colorful(n):
    s = list(map(int,str(n)))
    return len(s)*(len(s)+1)//2 == len({ reduce(int.__mul__, s[i:i+x]) for x in range(1,len(s)+1) for i in range(len(s)-x+1)})

from functools import reduce


def colorful(n):
    p = list(get_sub_mul(n))
    return len(p) == len(set(p))


def get_sub_mul(n):
    s = [int(d) for d in str(n)]
    l = len(s)
    for k in range(1, l+1):
        for i in range(l-k+1):
            yield reduce(int.__mul__, s[i:i+k])


from functools import reduce
from math import ceil
def colorful(n): 
    li=[reduce(lambda x,y: x*y, map(int, str(n)[i:i+j]))for j in range(1,ceil(len(str(n)) / 2)+2)for i in range(0,len(str(n))-j+1)]
    return all(li.count(i)==1 for i in li)