Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 7 characters in body
Source Link
Chas Brown
  • 9.8k
  • 1
  • 14
  • 39

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

Try it online! Try it online!

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

Try it online!

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

Try it online!

22 bytes from tips by Jonathan Allan.

Uses 01234567 as the 8 characters instead of 8 colors.

deleted 28 characters in body
Source Link
Chas Brown
  • 9.8k
  • 1
  • 14
  • 39

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

Try it online! Try it online!

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

Try it online!

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

Try it online!

20 bytes from tips by Jonathan Allan .

Uses 01234567 as the 8 characters instead of 8 colors.

deleted 28 characters in body
Source Link
Chas Brown
  • 9.8k
  • 1
  • 14
  • 39

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

Try it online! Try it online!

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

Try it online!

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

Try it online!

Uses 01234567 as the 8 characters instead of 8 colors.

deleted 26 characters in body
Source Link
Chas Brown
  • 9.8k
  • 1
  • 14
  • 39
Loading
deleted 3 characters in body
Source Link
Chas Brown
  • 9.8k
  • 1
  • 14
  • 39
Loading
Source Link
Chas Brown
  • 9.8k
  • 1
  • 14
  • 39
Loading

AltStyle によって変換されたページ (->オリジナル) /