Skip to main content
added 469 characters in body; added 58 characters in body; added 5 characters in body
Source Link
Nick Kennedy
  • 21.2k
  • 3
  • 18
  • 44

Jelly, 53 43 bytes

ŒṗQƑƇḂ⁹ƤḄ_’ʋⱮ3Ȧ$ƇṀÞḢµạṀIḂ’+Ʋ⁶ẋ;"b1KḣƊ€z⁶ZŒB 

Try it online!

A monadic link taking an integer and returning a list of lists. >50% of the code is focused on the ASCII art aspect. If a list of integers indicating row sizes were permissible, this would be 20 bytes.

In brief, this is the algorithm:

  1. Generate all integer partitions of n
  2. Keep only those made of distinct integers
  3. Keep only those where there is no length 2 subsequence of odd numbers and no length 3 subsequence that is odd, even, even.
  4. Keep one of the lists with the smallest maximum integer
  5. Left pad the list of integers with spaces; in general, this is max integer minus current integer, but where there are two even numbers in a row, there is one less space.
  6. Half the integer, rounding up, convert to unary and separate with spaces, with an extra space if the integer is even
  7. Right pad with spaces to make each line the same length.
  8. Palindromise each line

Full explanation to follow.


As an alternative, here’s a translation of @LevelRiverSts clever Ruby solution:

Jelly, 49 bytes

ŻÄ_=2o<ʋ0Tðb1K€a3¦€3¦S_Ḃo¬Ɗɗ^Ø.¦"S_HĊʋb1ɗŻṛ¡"U{o⁶ 

Try it online!

Jelly, 53 43 bytes

ŒṗQƑƇḂ⁹ƤḄ_’ʋⱮ3Ȧ$ƇṀÞḢµạṀIḂ’+Ʋ⁶ẋ;"b1KḣƊ€z⁶ZŒB 

Try it online!

A monadic link taking an integer and returning a list of lists. >50% of the code is focused on the ASCII art aspect. If a list of integers indicating row sizes were permissible, this would be 20 bytes.

In brief, this is the algorithm:

  1. Generate all integer partitions of n
  2. Keep only those made of distinct integers
  3. Keep only those where there is no length 2 subsequence of odd numbers and no length 3 subsequence that is odd, even, even.
  4. Keep one of the lists with the smallest maximum integer
  5. Left pad the list of integers with spaces; in general, this is max integer minus current integer, but where there are two even numbers in a row, there is one less space.
  6. Half the integer, rounding up, convert to unary and separate with spaces, with an extra space if the integer is even
  7. Right pad with spaces to make each line the same length.
  8. Palindromise each line

Full explanation to follow.

Jelly, 53 43 bytes

ŒṗQƑƇḂ⁹ƤḄ_’ʋⱮ3Ȧ$ƇṀÞḢµạṀIḂ’+Ʋ⁶ẋ;"b1KḣƊ€z⁶ZŒB 

Try it online!

A monadic link taking an integer and returning a list of lists. >50% of the code is focused on the ASCII art aspect. If a list of integers indicating row sizes were permissible, this would be 20 bytes.

In brief, this is the algorithm:

  1. Generate all integer partitions of n
  2. Keep only those made of distinct integers
  3. Keep only those where there is no length 2 subsequence of odd numbers and no length 3 subsequence that is odd, even, even.
  4. Keep one of the lists with the smallest maximum integer
  5. Left pad the list of integers with spaces; in general, this is max integer minus current integer, but where there are two even numbers in a row, there is one less space.
  6. Half the integer, rounding up, convert to unary and separate with spaces, with an extra space if the integer is even
  7. Right pad with spaces to make each line the same length.
  8. Palindromise each line

Full explanation to follow.


As an alternative, here’s a translation of @LevelRiverSts clever Ruby solution:

Jelly, 49 bytes

ŻÄ_=2o<ʋ0Tðb1K€a3¦€3¦S_Ḃo¬Ɗɗ^Ø.¦"S_HĊʋb1ɗŻṛ¡"U{o⁶ 

Try it online!

deleted 33 characters in body
Source Link
Nick Kennedy
  • 21.2k
  • 3
  • 18
  • 44

Jelly, 53 4643 bytes

ŒṗQƑƇḂ⁹ƤḄ_’ʋⱮ3Ȧ$ƇṀÞḢµạṀIḂ’+Ʋ;Ṁ⁶ẋ;"HĊb1K€Ʋz⁶ZŒBŒṗQƑƇḂ⁹ƤḄ_’ʋⱮ3Ȧ$ƇṀÞḢµạṀIḂ’+Ʋ⁶ẋ;"b1KḣƊ€z⁶ZŒB 

Try it online!Try it online!

A monadic link taking an integer and returning a list of lists. >50% of the code is focused on the ASCII art aspect. If a list of integers indicating row sizes were permissible, this would be 20 bytes.

In brief, this is the algorithm:

  1. Generate all integer partitions of n
  2. Keep only those made of distinct integers
  3. Keep only those where there is no length 2 subsequence of odd numbers and no length 3 subsequence that is odd, even, even.
  4. Keep one of the lists with the smallest maximum integer
  5. Left pad the list of integers with spaces; in general, this is max integer minus current integer, but where there are two even numbers in a row, there is one less space.
  6. Half the integer, rounding up, convert to unary and separate with spaces., with an extra space if the integer is even
  7. Right pad with spaces to make each line the same length, ensuring the minimum length is the max integer in the list (needed for 2 and 4).
  8. Palindromise each line

Full explanation to follow.

Jelly, 53 46 bytes

ŒṗQƑƇḂ⁹ƤḄ_’ʋⱮ3Ȧ$ƇṀÞḢµạṀIḂ’+Ʋ;Ṁ⁶ẋ;"HĊb1K€Ʋz⁶ZŒB 

Try it online!

A monadic link taking an integer and returning a list of lists. >50% of the code is focused on the ASCII art aspect. If a list of integers indicating row sizes were permissible, this would be 20 bytes.

In brief, this is the algorithm:

  1. Generate all integer partitions of n
  2. Keep only those made of distinct integers
  3. Keep only those where there is no length 2 subsequence of odd numbers and no length 3 subsequence that is odd, even, even.
  4. Keep one of the lists with the smallest maximum integer
  5. Left pad the list of integers with spaces; in general, this is max integer minus current integer, but where there are two even numbers in a row, there is one less space.
  6. Half the integer, rounding up, convert to unary and separate with spaces.
  7. Right pad with spaces to make each line the same length, ensuring the minimum length is the max integer in the list (needed for 2 and 4).
  8. Palindromise each line

Full explanation to follow.

Jelly, 53 43 bytes

ŒṗQƑƇḂ⁹ƤḄ_’ʋⱮ3Ȧ$ƇṀÞḢµạṀIḂ’+Ʋ⁶ẋ;"b1KḣƊ€z⁶ZŒB 

Try it online!

A monadic link taking an integer and returning a list of lists. >50% of the code is focused on the ASCII art aspect. If a list of integers indicating row sizes were permissible, this would be 20 bytes.

In brief, this is the algorithm:

  1. Generate all integer partitions of n
  2. Keep only those made of distinct integers
  3. Keep only those where there is no length 2 subsequence of odd numbers and no length 3 subsequence that is odd, even, even.
  4. Keep one of the lists with the smallest maximum integer
  5. Left pad the list of integers with spaces; in general, this is max integer minus current integer, but where there are two even numbers in a row, there is one less space.
  6. Half the integer, rounding up, convert to unary and separate with spaces, with an extra space if the integer is even
  7. Right pad with spaces to make each line the same length.
  8. Palindromise each line

Full explanation to follow.

added 759 characters in body
Source Link
Nick Kennedy
  • 21.2k
  • 3
  • 18
  • 44

Jelly, 53 46 bytes

ŒṗQƑƇḂ⁹ƤḄ_’ʋⱮ3Ȧ$ƇṀÞḢµạṀIḂ’+Ʋ;Ṁ⁶ẋ;"HĊb1K€Ʋz⁶ZŒB 

Try it online!

A monadic link taking an integer and returning a list of lists. >50% of the code is focused on the ASCII art aspect. If a list of integers indicating row sizes were permissible, this would be 20 bytes.

In brief, this is the algorithm:

  1. Generate all integer partitions of n
  2. Keep only those made of distinct integers
  3. Keep only those where there is no length 2 subsequence of odd numbers and no length 3 subsequence that is odd, even, even.
  4. Keep one of the lists with the smallest maximum integer
  5. Left pad the list of integers with spaces; in general, this is max integer minus current integer, but where there are two even numbers in a row, there is one less space.
  6. Half the integer, rounding up, convert to unary and separate with spaces.
  7. Right pad with spaces to make each line the same length, ensuring the minimum length is the max integer in the list (needed for 2 and 4).
  8. Palindromise each line

Full explanation to follow.

Jelly, 53 46 bytes

ŒṗQƑƇḂ⁹ƤḄ_’ʋⱮ3Ȧ$ƇṀÞḢµạṀIḂ’+Ʋ;Ṁ⁶ẋ;"HĊb1K€Ʋz⁶ZŒB 

Try it online!

A monadic link taking an integer and returning a list of lists. >50% of the code is focused on the ASCII art aspect. If a list of integers indicating row sizes were permissible, this would be 20 bytes.

Jelly, 53 46 bytes

ŒṗQƑƇḂ⁹ƤḄ_’ʋⱮ3Ȧ$ƇṀÞḢµạṀIḂ’+Ʋ;Ṁ⁶ẋ;"HĊb1K€Ʋz⁶ZŒB 

Try it online!

A monadic link taking an integer and returning a list of lists. >50% of the code is focused on the ASCII art aspect. If a list of integers indicating row sizes were permissible, this would be 20 bytes.

In brief, this is the algorithm:

  1. Generate all integer partitions of n
  2. Keep only those made of distinct integers
  3. Keep only those where there is no length 2 subsequence of odd numbers and no length 3 subsequence that is odd, even, even.
  4. Keep one of the lists with the smallest maximum integer
  5. Left pad the list of integers with spaces; in general, this is max integer minus current integer, but where there are two even numbers in a row, there is one less space.
  6. Half the integer, rounding up, convert to unary and separate with spaces.
  7. Right pad with spaces to make each line the same length, ensuring the minimum length is the max integer in the list (needed for 2 and 4).
  8. Palindromise each line

Full explanation to follow.

deleted 23 characters in body; deleted 8 characters in body
Source Link
Nick Kennedy
  • 21.2k
  • 3
  • 18
  • 44
Loading
edited body
Source Link
Nick Kennedy
  • 21.2k
  • 3
  • 18
  • 44
Loading
added 6 characters in body; deleted 1 character in body
Source Link
Nick Kennedy
  • 21.2k
  • 3
  • 18
  • 44
Loading
Source Link
Nick Kennedy
  • 21.2k
  • 3
  • 18
  • 44
Loading