首先分析首行规律,首行每个数字和前一个数字的差值每次都增加1 即增量每迭代1次就加1

分析行之间差距 每一行取上一行第一位数字之外的元素,并对每个元素减去1即可

def get_first_line(count):
    arr, increase = [1], 2
    for i in range(1, count):
        arr.append(arr[i - 1] + increase)
        increase += 1
    return arr


def get_all_lines(arr):
    result = []
    # result.append(arr)
    count = len(arr)
    for i in range(count):
        result.append(arr)
        arr = [value - 1 for value in arr[1:]]
    return result


while True:
    try:
        arr1 = get_first_line(int(input()))
        res = get_all_lines(arr1)
        for x in res:
            for num in x:
                print(num, end=' ')
            print()
    except EOFError: break