A text that can be arranged triangularly in some fashion can be read back in some other fashion effectively enciphering it.
Narrowing down a set of plausible triangular numberings allows to individuate the set of plausible transpositions the text underwent.
Consider these 3 basic "scan-line" groupings
- / \
- - / / \ \
- - - / / / \ \ \
- - - - / / / / \ \ \ \
each one can be traversed in 4 different ways (changing direction and orientation)
We have 12 basic numberings.
For example
1
2 3
4 5 6
7 8 9 10
1) 1,2,3,4,5,6,7,8,9,10 -
2) 7,8,9,10,4,5,6,2,3,1 - -
3) 1,3,2,6,5,4,10,9,8,7 - - -
4) 10,9,8,7,6,5,4,3,2,1 - - - -
5) 10,6,9,3,5,8,1,2,4,7 /
6) 1,2,4,7,3,5,8,6,9,10 / /
7) 10,9,6,8,5,3,7,4,2,1 / / /
8) 7,4,2,1,8,5,3,9,6,10 / / / /
9) 7,8,4,9,5,2,10,6,3,1 \
10) 10,6,3,1,9,5,2,8,4,7 \ \
11) 7,4,8,2,5,9,1,3,6,10 \ \ \
12) 1,3,6,10,2,5,9,4,8,7 \ \ \ \
Enciphering boils down in mapping a text via the inverse of any one of these mappings and then again through any other one (can be the same, yielding no cipher)
Turns out said 12 basic numberings allows for 22 distinct text transpositions.
Clearly this number doesn't depend on the size of the triangle (except for too small ones having less due to more collision).
Task
Given a positive integer n
, n >= 4
,
return in any order such 22
distinct triangular transpositions of an n
-triangular long text as a list of lists of integers.
This is code-golf, shortest solution wins.
mpjheuoicsgdgitemshfairealipepitrycadchnhesid