Skip to main content
deleted 5 characters in body
Source Link
dylnan
  • 5.4k
  • 2
  • 16
  • 33

Jelly, 63 62 62 56 5655 bytes

ḊFµQiЀµḤ’ḤḊFµi@€QḤ’Ḥ
“ŒµḊuÆẓƙỊ’D,“çƥ÷£ḟ’ṃ“spdf”¤µxÇZ
¢ḣŒg'µQ€żL€K

Try it online!Try it online!

Jelly, 63 62 56 bytes

ḊFµQiЀµḤ’Ḥ
“ŒµḊuÆẓƙỊ’D,“çƥ÷£ḟ’ṃ“spdf”¤µxÇZ
¢ḣŒg'µQ€żL€K

Try it online!

Jelly, 63 62 56 55 bytes

ḊFµi@€QḤ’Ḥ
“ŒµḊuÆẓƙỊ’D,“çƥ÷£ḟ’ṃ“spdf”¤µxÇZ
¢ḣŒg'µQ€żL€K

Try it online!

Bounty Ended with 100 reputation awarded by MD XF
added 1779 characters in body
Source Link
dylnan
  • 5.4k
  • 2
  • 16
  • 33

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 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

Explanation to be finished soon...

  • “ŒµḊuÆẓƙỊ’ Is the number 1223334445545665677 compressed into base 250. D gives turns this into a list of digits.

Explanation

  • “ŒµḊuÆẓƙỊ’ is 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 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
added 307 characters in body
Source Link
dylnan
  • 5.4k
  • 2
  • 16
  • 33

Jelly, 63 62 56 bytes

ḊFµQiЀµḤ’Ḥ
“ŒµḊuÆẓƙỊ’D,“çƥ÷£ḟ’ṃ“spdf”¤µxÇZ
¢ḣŒg'µQ€żL€K

Try it online!

Thanks to user202729 for saving 6 bytes with base decompression!

Explanation to comebe finished soon...

First I construct the list [[1,2,2,3,3,3,4,4,4,5,5,4,5,6,6,5,6,7,7],'sspspdspdspfdspfdsp'] with the code “ŒµḊuÆẓƙỊ’D,“çƥ÷£ḟ’ṃ“spdf”¤ in the second link.

  • “ŒµḊuÆẓƙỊ’ Is the number 1223334445545665677 compressed into base 250. D gives turns this into a list of digits.

Jelly, 63 62 56 bytes

ḊFµQiЀµḤ’Ḥ
“ŒµḊuÆẓƙỊ’D,“çƥ÷£ḟ’ṃ“spdf”¤µxÇZ
¢ḣŒg'µQ€żL€K

Try it online!

Thanks to user202729 for saving 6 bytes with base decompression!

Explanation to come soon...

Jelly, 63 62 56 bytes

ḊFµQiЀµḤ’Ḥ
“ŒµḊuÆẓƙỊ’D,“çƥ÷£ḟ’ṃ“spdf”¤µxÇZ
¢ḣŒg'µQ€żL€K

Try it online!

Thanks to user202729 for saving 6 bytes with base decompression!

Explanation to be finished soon...

First I construct the list [[1,2,2,3,3,3,4,4,4,5,5,4,5,6,6,5,6,7,7],'sspspdspdspfdspfdsp'] with the code “ŒµḊuÆẓƙỊ’D,“çƥ÷£ḟ’ṃ“spdf”¤ in the second link.

  • “ŒµḊuÆẓƙỊ’ Is the number 1223334445545665677 compressed into base 250. D gives turns this into a list of digits.
added 35 characters in body
Source Link
dylnan
  • 5.4k
  • 2
  • 16
  • 33
Loading
added 493 characters in body
Source Link
dylnan
  • 5.4k
  • 2
  • 16
  • 33
Loading
added 10 characters in body
Source Link
dylnan
  • 5.4k
  • 2
  • 16
  • 33
Loading
Source Link
dylnan
  • 5.4k
  • 2
  • 16
  • 33
Loading