>When no more interesting kata can be resolved, I just choose to create the new kata, to solve their own, to enjoy the process  --myjinxin2015 said

# Description:
 Give you two number `m` and `n`(two positive integer, m < n), make a triangle pattern with number sequence `m to n`. The order is clockwise, starting from the top corner, like this:
 
```
 When m=1 n=10  triangle is:
    1
   9 2
  8 0 3
 7 6 5 4
```
 Note: The pattern only uses the last digit of each number; Each row separated by "\n"; Each digit separated by a space; Left side may need pad some spaces, but don't pad the right side; If `m to n` can not make the triangle, return `""`.
  
# Some examples:

```
makeTriangle(1,3) should return:
 1
3 2

makeTriangle(6,20) should return: 

    6
   7 7
  6 8 8
 5 0 9 9
4 3 2 1 0

makeTriangle(1,12) should return ""
 
```

Difficulty: introductory

Starter code:

def make_triangle(m,n):
	

Solutions:
def make_triangle(m,n):
    lns, sm = 0, 0
    while sm < n - m + 1:
        lns += 1
        sm += lns
    if sm > n - m + 1: return ""
    matrix = [[0] * (i + 1) for i in range(lns)]
    y, x, s = 0, 0, 0
    ds = ((1, 1), (0, -1), (-1, 0))
    dy, dx = ds[s]
    for i in range(m, n + 1):
        matrix[y][x] = str(i % 10)
        if not 0 <= y + dy < len(matrix) or not 0 <= x + dx < len(matrix[y + dy]) or matrix[y + dy][x + dx]:
            s += 1
            dy, dx = ds[s % 3]
        y, x = y + dy, x + dx
    return "\n".join(" ".join(ln).center(len(matrix[-1]) * 2 - 1).rstrip() for ln in matrix)

from itertools import cycle
from math import sqrt


def make_triangle(start, end):
    rows = sqrt(8 * (end - start) + 9) / 2 - .5

    if not rows.is_integer():
        return ''

    rows = int(rows)
    row, col, value = -1, -1, start

    directions = cycle([(1, 0), (0, -1), (-1, 1)])
    triangle = [[''] * n for n in range(1, rows + 1)]

    for times in range(rows, 0, -1):
        cur_dir = next(directions)

        for _ in range(times):
            row += cur_dir[0]
            col += cur_dir[1]

            triangle[row][col] = str(value % 10)
            value += 1

    return "\n".join(' ' * (rows - i - 1) + ' '.join(r) for i, r in enumerate(triangle))


from itertools import cycle

MOVES = ((1,1),(0,-1),(-1,0))

def make_triangle(m,n):
    X = ((1+8*(n-m+1))**.5-1) / 2
    if X%1: return ''
    
    X   = int(X)
    tri = [[-1]*(i+1) for i in range(int(X))]
    x,y,v,moves = 0, 0, m%10, cycle(MOVES)
    dx,dy = next(moves)
    for _ in range(n-m+1):
        tri[x][y] = str(v)
        v = (v+1)%10
        if not (0<=x+dx<X and 0<=y+dy<X) or tri[x+dx][y+dy]!=-1:
            dx,dy = next(moves)
        x+=dx ; y+=dy
    return '\n'.join(' '*(X-i-1)+' '.join(row) for i,row in enumerate(tri))

def make_triangle(m,n):
    size = ((8*(n-m+1)+1)**.5-1)/2
    if size % 1 : return ''
    
    grid = [[' ' for _ in range(int(size)*2-1)] for _ in range(int(size))]
    i,j = 0,int(size-1)
    grid[i][j] = str(m%10)
    
    while m<n:
        for inc,dec in [(1,1),(0,-2),(-1,1)]:
            while 0<=i+inc<size and 0<=j+dec<size*2-1 and grid[i+inc][j+dec].isspace():
                i, j, m = i+inc, j+dec, m+1
                grid[i][j] = str(m%10)
                
    return '\n'.join([''.join(i).rstrip() for i in grid])

def make_triangle(m, n):
    """
    makeTriangle produces a ∆ in a special sequence of numbers.
    m is the starting point and n is the finishibg one.
    The final digit of each number is taken as a character in making the ∆.
    This functions returns a ∆ as a string if possible with the given input else, returns an empty string.
    """

    #Type check for arguments
    if (type(m)!=type(0)) or (type(n)!=type(0)):
        raise TypeError("m and n should be int")
    #Value check for arguments
    if m >= n:
        raise ValueError("m not < n")

    chars = [str(i)[-1] for i in range(m, n+1)]
    #chars contains all the characters that will make up the ∆.
    
    #Can this set of chars make a ∆.
    row, charc = 0, 0 #ncpr is the no. of rows in a ∆. And charc is the no. of characters a ∆ of specific side length contains. Both initially set to 0.

    while True:
        #The loop will break if the ∆ is possible else, will cause the function to return an empty string.
        row += 1; charc = 0
        for j in range(1, row): charc += j
        if len(chars) == charc: row -= 1; break
        if len(chars) < charc: return ''
    
    #∆ generation
    lor = [[' ' for j in range(i)] for i in range(1, row+1)] #lor contains all the rows of the ∆ as white strings.
    #For Step-1 to work
    i1,sp, b = 0, 0, -1
    #For Step-2 to work
    c = 2
    i2, l = row-c, 0
    #For Step-3 to work
    i3, j= row-2, 0
    while True: 
        if len(chars)==0: break
        #Step-1
        while i1 <= row-1:
            lor[i1][b] = chars[0]
            chars.pop(0)
            i1 += 1
        i1 = sp+2; b -= 1
        if len(chars)==0: break
        #Step-2
        while i2 >= l:
            lor[row-1][i2] = chars[0]
            chars.pop(0)
            i2 -= 1
        row -= 1; c += 1; i2 = row-c; l += 1
        if len(chars)==0: break
        #Step-3
        while i3 > sp:
            lor[i3][j] = chars[0]
            chars.pop(0)
            i3 -= 1
        i3 = row-2; j += 1; sp += 2
    l = ''
    for i in lor:
        if i==lor[0]:
            l += ' '*(len(lor)-len(i))+i[0]+'\n'
            continue
        for j in range(len(i)):
            if j==0:
                l += ' '*(len(lor)-len(i))+i[j]+' '
            elif j==len(i)-1:
                l += i[j]
            else:
                l += i[j]+' '
        if i!=lor[-1]:
            l += '\n'
    return l

def make_triangle(m,n):
    count=0
    rec=n-m+1
    for i in range(1,99999999):
        count+=i
        if count>rec:
            return ""
        elif count==rec:
            limit=i
            break
    right=limit
    left=0
    triangle=[[" "]*i for i in range(1,limit+1)]  
    while m<=n:
        for i in range(left,right):
            triangle[i+left][i]=str(m%10)
            m+=1
        right-=1
        for i in range(right-1,left-1,-1):
            triangle[right+left][i]=str(m%10)
            m+=1
        right-=1
        for i in range(right,left,-1):
            triangle[i+left][left]=str(m%10)
            m+=1
        left+=1
    res=[]
    for j,i in enumerate(triangle):
        res.append(" "*(limit-(j)-1)+" ".join(i))
    return "\n".join(res)

def make_triangle(n,m):
    layers = layer(m-n+1)
    if layers == False:
        return ""
    board = []
    for i in range(layers):
        board.append([""]*(i+1))
    triangle = make(n%10,board,0,0,len(board))
    return tri_print(triangle)
    
def layer(n):
    a = 0
    layer = 0
    for i in range(1,n):
        a+= i
        layer += 1
        if a == n:
            return layer
        elif a > n:
            return False
        else:
            continue
def tri_print(board):
    sentence = ""
    for i in range(len(board)):
        sentence += " "*(len(board)-1-i)
        for j in range(len(board[i])):
            sentence+= str(board[i][j]) + " "
        sentence = sentence[:-1] + "\n"
    return sentence[:-1]
    
    
def make(n,board,row,col,x):
    for i in range(row,x):
        if board[i][col] == "":
            board[i][col] = n
            if n == 9:
                n = 0
            else:
                n+=1
        col +=1
    for j in range(x-1,-1,-1):
        if board[x-1][j] == "" :
            board[x-1][j] = n
            n_col = j
            if n == 9:
                n = 0
            else:
                n+=1
    if check(board):
        return board
    for z in range(x-1,row,-1):
        if board[z][n_col] == "":
            board[z][n_col] = n
            rw,cl = z,n_col
            if n == 9:
                n = 0
            else:
                n+=1
                
    if not check(board):
        return make(n,board,rw,cl,x-1)
    return board

def check(board):
    for i in board:
        for j in i:
            if j == "" :
                return False
    return True

def make_triangle(start, end):
    from itertools import cycle
    from math import sqrt

    rows = sqrt(8 * (end - start) + 9) / 2 - .5
    if not rows.is_integer():
        return ''

    rows = int(rows)
    row, col, fill = -1, -1, start
    ls = [[''] * n for n in range(1, rows+1)]
    directions = cycle([(1, 1), (0, -1), (-1, 0)])

    for i in range(rows):
        dir = next(directions)

        for j in range(rows-i):
            row += dir[0]
            col += dir[1]
            ls[row][col] = str(fill%10)
            fill += 1

    return '\n'.join(' ' * (rows-i-1) + ' '.join(r) for i, r in enumerate(ls))


import numpy as np
def make_triangle(m,n):
    num=n-m+1
    level=int((num*2)**(1.0/2))
    if level*(level+1)/2!=num:
        return ""
    else:
        level_max=level*2-1
        npres=np.full((level,level_max),' ')
        l,p,f=0,level_max//2,int(str(m)[-1])
        for i in range(num):
            npres[l][p]=f
            f=(f+1)%10
            if p>=level_max//2 and l!=level-1:
                if npres[l+1][p+1]==' ':
                    l+=1
                    p+=1
                else:
                    p-=2
                    level-=1
            elif l==level-1 and p>0:
                if npres[l][p-2]==' ':
                    p-=2
                else:
                    p+=1
                    l-=1
            elif (p<level_max//2 and l!=level-1) or( l==level-1 and p==0):
                if npres[l - 1][p + 1] == ' ':
                    p+=1
                    l-=1
                else:
                    l+=1
                    p+=1
        res='\n'.join(''.join(str(x) for x in n).rstrip() for n in npres.tolist() )
        return res

def make_triangle(m,n):
    if n == m:
        return m

    else:
        Num = len(range(m,n+1))

        elNum = 0
        k = 1
        while elNum < Num:
            k += 1
            elNum = int(k*(k+1)/2)
        
        if elNum != Num:
            return ""
    
    Lyr = (k-1)//3 + 1


    L1 = []
    for i in range(k):
        L1.append([])
        for j in range(k+i):
            L1[-1].append(" ")
        L1[-1].append("\n")

    el = m-1

    for CLyr in range(Lyr):
        topR = 2*CLyr
        topC = -2*(CLyr+1)
        
        CSize = k - 3*CLyr

        for i in range(CSize):
            el += 1
            L1[topR+i][-2*(1+CLyr)] = str(el % 10)

        for i in range(CSize-1):
            el += 1
            L1[topR+CSize-1][-4-2*(i+CLyr)] = str(el % 10)

        for i in range(CSize-2):
            el += 1
            L1[topR+CSize-1-1-i][i+1+CLyr*3] = str(el % 10)

    L2 = [e for inner_list in L1 for e in inner_list][:-1]
    return "".join(L2)