Explanation to be finished soon...
“ŒµḊuÆẓƙỊ’
Isis the number 1223334445545665677
compressed into base 250. D
gives turns this into a list of digits.
“çƥ÷£ḟ’ṃ“spdf”
changes the base 250 number “çƥ÷£ḟ’
into base 4 and indexes it into the string “spdf”
yielding 'sspspdspdspfdspfdsp'
. This was contributed by user202729.
The list is then take to the fist link by Ç
. The first link does the following:
ḊFµQiЀµḤ’Ḥ
ḊF Dequeue then flatten yields 'sspspd...'. Ṫ doesn't work because it modifies the input.
µ New monadic link
Q Unique elements → 'spdf'
iЀ The index of each of 'sspspd...' into the string 'spdf' → [1,1,2,1,2,3...]
µ New monadic link. This prevents Ḥ from acting on the right argument of iЀ.
Ḥ’Ḥ Takes [1,1,2,1...] and computes 2(2l+1) → [2,2,6,2,6,10...]
Now back to the second link. With xÇ
we repeat each of the elements in each sublist of [[1,2,2,3...7],['sspspd...p']]
by the numbers in our new list [2,2,6...]
. This yields [[1,1,2,2,2,2...],['sssspp...']]
. Z
zips the two sublist which yields [[1,'s'],[1,'s'],[2,'s']...]
.
Now to the main link. ¢
calls the second link which yields the final list of tuples described above. Assume the input to the program is 5 as an example.
¢ḣŒg'µQ€żL€K
¢ Calls the second link as a nilad which yields the final list of tuples described above
ḣ Takes the first 5 tuples → [[1,'s'],[1,'s'],[2,'s'],[2,'s'],[2,'p']]
Œg' Group together runs of equal elements → [[[1,'s'],[1,'s']],[[2,'s'],[2,'s']],[[2,'p']]]
µ New monadic link
Q€ Unique elements of each of these runs
L€ Length of each of these runs
ż Zip these together → [[[1,'s'],2],[[2,'s'],2],[[2,'p'],1]]
K Join this list with spaces → 1s2 2s2 2p1