Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

80%
+6 −0
Challenges Diagonalized alphabet

BQN, 18 bytesSBCS 'A'-¬⊸⌊2×13-˜⌜○↕14 Run online! This solution computes a table of c-r, where r is the row number and c is the column number, so that the first row is 0 1 2… and the first colu...

posted 3y ago by Marshall Lochbaum‭

Answer
#1: Initial revision by user avatar Marshall Lochbaum‭ · 2021-06-11T15:20:15Z (almost 3 years ago)
# [BQN](https://mlochbaum.github.io/BQN/), 18 bytes<sup>[SBCS](https://github.com/mlochbaum/BQN/blob/master/commentary/sbcs.bqn)</sup>

```
'A'-¬⊸⌊2×13-˜⌜○↕14
```

[Run online!](https://mlochbaum.github.io/BQN/try.html#code=J0EnLcKs4oq44oyKMsOXMTMty5zijJzil4vihpUxNA==)

This solution computes a table of `c-r`, where `r` is the row number and `c` is the column number, so that the first row is `0 1 2…` and the first column is `0 ¯1 ¯2…`. After this it maps non-positive numbers `0 ¯1 ¯2…` to `A C E…`, and positive ones `1 2…` to `B D…`, using the arithmetic expanded below. BQN's [extension](https://mlochbaum.github.io/BQN/doc/logic.html) of boolean negation `¬` to mean one minus the argument is helpful here.

```
'A'-¬⊸⌊2×13-˜⌜○↕14
         13     14  # Numbers
              ○↕    # Range of each
           -˜⌜      # Subtract-from table    0 ¯1 ¯2 /  1  2
       2×           # Times two              0 ¯2 ¯4 /  2  4
    ¬⊸              # 1 minus, then…         1  3  5 / ¯1 ¯3
      ⌊             # Minimum with original  0 ¯2 ¯4 / ¯1 ¯3
'A'-                # Subtract from 'A'      A  C  E /  B  D
```