Python 2, (削除) 158 (削除ここまで) 134(削除) 134 (削除ここまで) 132 bytes
n,d=input()
r=[1]o=r=[1]
exec"print''.join([`i`for i in range(8)if c%d**i<1][-1]*2for c in r).center(2*n);r=[1]+map;r=o+map(sum,zip(r,r[1:]))+[1];"*n+o;"*n
2022 bytes from tips by Jonathan Allan.
Uses 01234567 as the 8 characters instead of 8 colors.
Python 2, (削除) 158 (削除ここまで) 134 bytes
n,d=input()
r=[1]
exec"print''.join([`i`for i in range(8)if c%d**i<1][-1]*2for c in r).center(2*n);r=[1]+map(sum,zip(r,r[1:]))+[1];"*n
20 bytes from tips by Jonathan Allan.
Uses 01234567 as the 8 characters instead of 8 colors.
Python 2, (削除) 158 (削除ここまで) (削除) 134 (削除ここまで) 132 bytes
n,d=input()
o=r=[1]
exec"print''.join([`i`for i in range(8)if c%d**i<1][-1]*2for c in r).center(2*n);r=o+map(sum,zip(r,r[1:]))+o;"*n
22 bytes from tips by Jonathan Allan.
Uses 01234567 as the 8 characters instead of 8 colors.
Python 2, (削除) 158 (削除ここまで) 139134 bytes
n,d=input()
r=[1]
exec"print''.join([`i`for i in range(8)if c%d**i<1][-1]*2for c in r).center(2*n);r=[1]+map(sum,zip(r[:-1]r,r[1:]))+[1];"*n
20 bytes from tips by Jonathan Allan .
Uses 01234567 as the 8 characters instead of 8 colors.
Python 2, (削除) 158 (削除ここまで) 139 bytes
n,d=input()
r=[1]
exec"print''.join([`i`for i in range(8)if c%d**i<1][-1]*2for c in r).center(2*n);r=[1]+map(sum,zip(r[:-1],r[1:]))+[1];"*n
Uses 01234567 as the 8 characters instead of 8 colors.
Python 2, (削除) 158 (削除ここまで) 134 bytes
n,d=input()
r=[1]
exec"print''.join([`i`for i in range(8)if c%d**i<1][-1]*2for c in r).center(2*n);r=[1]+map(sum,zip(r,r[1:]))+[1];"*n
20 bytes from tips by Jonathan Allan .
Uses 01234567 as the 8 characters instead of 8 colors.
Python 2, 158(削除) 158 (削除ここまで) 139 bytes
n,d=input()
r=[1]
exec"print''.join('.-~+*#@$'[[i for[`i`for i in range(8)if c%d**i<1][-1]]*2for1]*2for c in r).center(2*n);r=[1]+[a+b for a;r=[1]+map(sum,b in zip(r[:-1],r[1:])]+[1];"*n)+[1];"*n
Uses .-~+*#@$01234567 as the 8 characters instead of 8 colors.
Python 2, 158 bytes
n,d=input()
r=[1]
exec"print''.join('.-~+*#@$'[[i for i in range(8)if c%d**i<1][-1]]*2for c in r).center(2*n);r=[1]+[a+b for a,b in zip(r[:-1],r[1:])]+[1];"*n
Uses .-~+*#@$ as the 8 characters instead of 8 colors.
Python 2, (削除) 158 (削除ここまで) 139 bytes
n,d=input()
r=[1]
exec"print''.join([`i`for i in range(8)if c%d**i<1][-1]*2for c in r).center(2*n);r=[1]+map(sum,zip(r[:-1],r[1:]))+[1];"*n
Uses 01234567 as the 8 characters instead of 8 colors.