Post History
BQN, 11 9 bytesSBCS Run online! 1⌽⍟⊢⍋3|↕9 The result is a length 9 list of lists using the numbers 0 to 8. The solution is based on the 3x3 transpose list 036147258, obtained with Grade Up. T...
Answer
#3: Post edited
# [BQN](https://mlochbaum.github.io/BQN/), 11 bytes<sup>[SBCS](https://github.com/mlochbaum/BQN/blob/master/commentary/sbcs.bqn)</sup>- ```
9|+⌜⟜⊐⍋3|↕9- ```
[Run online!](https://mlochbaum.github.io/BQN/try.html#code=OXwr4oyc4p+c4oqQ4o2LM3zihpU5)Uses the numbers 0 to 8. The result is a 9x9 matrix.Idea is to use the numbers 0 to 8 in order for rows and the 3x3 transpose 036147258 for columns. Adding these in a [table](https://mlochbaum.github.io/BQN/doc/map.html#table) modulo 9 gives a valid solution. [Grade Up](https://mlochbaum.github.io/BQN/doc/order.html#grade) is used to get the transposed sequence and [Classify](https://mlochbaum.github.io/BQN/doc/selfcmp.html#classify) gets the original ordered range back, since all values in the argument are unique.- ```
- 9|+⌜⟜⊐⍋3|↕9
- ↕9 # Range 0…8
- 3| # Mod 3: 012012012
- ⍋ # Grade: 036147258
- +⌜⟜ # Addition table with…
- ⊐ # Classify 012345678
- 9| # Modulo 9
- ```
- # [BQN](https://mlochbaum.github.io/BQN/), ~~11~~ 9 bytes<sup>[SBCS](https://github.com/mlochbaum/BQN/blob/master/commentary/sbcs.bqn)</sup>
- [Run online!](https://mlochbaum.github.io/BQN/try.html#code=MeKMveKNn+KKouKNizN84oaVOQ==)
- ```
- 1⌽⍟⊢⍋3|↕9
- ```
- The result is a length 9 list of lists using the numbers 0 to 8.
- The solution is based on the 3x3 transpose list 036147258, obtained with [Grade Up](https://mlochbaum.github.io/BQN/doc/order.html#grade). This list is used to [repeat](https://mlochbaum.github.io/BQN/doc/repeat.html) the operation [rotating](https://mlochbaum.github.io/BQN/doc/reverse.html#rotate) itself by one. Since it's a self-inverse, each subsequent rotation starts it at a number one higher than the previous.
- ```
- 1⌽⍟⊢⍋3|↕9
- ↕9 # Range 0…8
- 3| # Mod 3: 012012012
- ⍋ # Grade: 036147258
- 1⌽ # Rotate by 1
- ⍟⊢ # Repeated n times for each number n
- ```
- ---
- Previous solution (11): [Run online!](https://mlochbaum.github.io/BQN/try.html#code=OXwr4oyc4p+c4oqQ4o2LM3zihpU5)
- Idea is to use the numbers 0 to 8 in order for rows and the 3x3 transpose 036147258 for columns. Adding these in a [table](https://mlochbaum.github.io/BQN/doc/map.html#table) modulo 9 gives a valid solution. [Classify](https://mlochbaum.github.io/BQN/doc/selfcmp.html#classify) gets the original ordered range back from the transpose, since all its elements are unique.
- ```
- 9|+⌜⟜⊐⍋3|↕9
- ↕9 # Range 0…8
- 3| # Mod 3: 012012012
- ⍋ # Grade: 036147258
- +⌜⟜ # Addition table with…
- ⊐ # Classify 012345678
- 9| # Modulo 9
- ```
#2: Post edited
- # [BQN](https://mlochbaum.github.io/BQN/), 11 bytes<sup>[SBCS](https://github.com/mlochbaum/BQN/blob/master/commentary/sbcs.bqn)</sup>
- ```
- 9|+⌜⟜⊐⍋3|↕9
- ```
- [Run online!](https://mlochbaum.github.io/BQN/try.html#code=OXwr4oyc4p+c4oqQ4o2LM3zihpU5)
Assumes 0-index; add 1 for 13 bytes if 1-indexed is required. The result is a 9x9 matrix.- Idea is to use the numbers 0 to 8 in order for rows and the 3x3 transpose 036147258 for columns. Adding these in a [table](https://mlochbaum.github.io/BQN/doc/map.html#table) modulo 9 gives a valid solution. [Grade Up](https://mlochbaum.github.io/BQN/doc/order.html#grade) is used to get the transposed sequence and [Classify](https://mlochbaum.github.io/BQN/doc/selfcmp.html#classify) gets the original ordered range back, since all values in the argument are unique.
- ```
- 9|+⌜⟜⊐⍋3|↕9
- ↕9 # Range 0…8
- 3| # Mod 3: 012012012
- ⍋ # Grade: 036147258
- +⌜⟜ # Addition table with…
- ⊐ # Classify 012345678
- 9| # Modulo 9
- ```
- # [BQN](https://mlochbaum.github.io/BQN/), 11 bytes<sup>[SBCS](https://github.com/mlochbaum/BQN/blob/master/commentary/sbcs.bqn)</sup>
- ```
- 9|+⌜⟜⊐⍋3|↕9
- ```
- [Run online!](https://mlochbaum.github.io/BQN/try.html#code=OXwr4oyc4p+c4oqQ4o2LM3zihpU5)
- Uses the numbers 0 to 8. The result is a 9x9 matrix.
- Idea is to use the numbers 0 to 8 in order for rows and the 3x3 transpose 036147258 for columns. Adding these in a [table](https://mlochbaum.github.io/BQN/doc/map.html#table) modulo 9 gives a valid solution. [Grade Up](https://mlochbaum.github.io/BQN/doc/order.html#grade) is used to get the transposed sequence and [Classify](https://mlochbaum.github.io/BQN/doc/selfcmp.html#classify) gets the original ordered range back, since all values in the argument are unique.
- ```
- 9|+⌜⟜⊐⍋3|↕9
- ↕9 # Range 0…8
- 3| # Mod 3: 012012012
- ⍋ # Grade: 036147258
- +⌜⟜ # Addition table with…
- ⊐ # Classify 012345678
- 9| # Modulo 9
- ```
#1: Initial revision
# [BQN](https://mlochbaum.github.io/BQN/), 11 bytes<sup>[SBCS](https://github.com/mlochbaum/BQN/blob/master/commentary/sbcs.bqn)</sup> ``` 9|+⌜⟜⊐⍋3|↕9 ``` [Run online!](https://mlochbaum.github.io/BQN/try.html#code=OXwr4oyc4p+c4oqQ4o2LM3zihpU5) Assumes 0-index; add 1 for 13 bytes if 1-indexed is required. The result is a 9x9 matrix. Idea is to use the numbers 0 to 8 in order for rows and the 3x3 transpose 036147258 for columns. Adding these in a [table](https://mlochbaum.github.io/BQN/doc/map.html#table) modulo 9 gives a valid solution. [Grade Up](https://mlochbaum.github.io/BQN/doc/order.html#grade) is used to get the transposed sequence and [Classify](https://mlochbaum.github.io/BQN/doc/selfcmp.html#classify) gets the original ordered range back, since all values in the argument are unique. ``` 9|+⌜⟜⊐⍋3|↕9 ↕9 # Range 0…8 3| # Mod 3: 012012012 ⍋ # Grade: 036147258 +⌜⟜ # Addition table with… ⊐ # Classify 012345678 9| # Modulo 9 ```