A cannonball is fired so that in the first eyeblink of its flight it ascends by N
treetops, during the second eyeblink by N-1
treetops, etc until it reaches the highest point of its trajectory. Then it starts falling by 1, 2, etc treetops per eyeblink until it hits the ground. At the same time the cannonball is moving horizontally with a constant velocity of 1 treetop/eyeblink.
Your task is to draw the trajectory with consecutive letters from the English alphabet. If you run out of letters, start again from 'A'
. Write a function or a program. The input is an integer N
(1≤N≤15
). The output can be a character matrix in any reasonable form, for instance a newline-separated string or a list of strings. Letters can be all lowercase or all uppercase. Extra leading and trailing spaces are allowed. Standard loopholes are forbidden. Shorter code is better.
in:
5
out:
OP
N Q
M R
L S
K T
J U
I V
H W
G X
F Y
E Z
D A
C B
B C
A D
in:
1
out:
AB
O
andP
, the tick goes 1 to the right, but 0 up- or down-wards. \$\endgroup\$