22
Given a positive integer n >= 1
, output the first n
rows of the following structure:
#
# #
###
# #
# # #
## ##
#####
# #
# # #
# # # #
# ### #
## ##
## # ##
### ###
#######
The n
-th 1-indexed row is the binary representation of n
, mirrored without copying the last character, with #
in place of 1 and <space>
in place of 0. All rows are centered.
You must output as ASCII-art but you may use any non-whitespace character in place of where I use #
in the example. Trailing whitespace is allowed, and a trailing newline is allowed. The output must look like the example, and no extra leading whitespace or leading newlines.
You can view the first 1023 rows of the fractal cathedral here.
To generate larger test cases, here's an ungolfed reference implementation in Python
Nice idea. I wouldn't have guessed binary numbers to have produced such pretty ascii art. – Jonah – 2017-08-14T01:21:33.800
@Jonah Thanks :) Glad you like it – HyperNeutrino – 2017-08-14T01:22:20.367
7Both links are pointing to the generated cathedral. – Otávio – 2017-08-14T10:30:34.577
@Otávio :I will fix, thanks – HyperNeutrino – 2017-08-14T15:32:12.620