-4
\$\begingroup\$

This time I will give you an easy challenge:
Print the Om sign with \$\pi\$!(Sorry for many challenges with \$\pi\$)

Here is the om sign drawn using pi numbers:

 59 0 64
 230781
3.14159
 26 502884
 535 83279 1971
 89 433 6939
 79 44 937
 323 749 510
 84 58209
626

Here is the sequence I used to order the numbers of \$\pi\$:

om sign

Rules

  • There will be no input(except it has to be)
  • The program should print the sign to STDOUT
  • Its's , so the shortest code in bytes wins!
  • You must include all the spaces and line breaks in the original text.

Good luck

asked Jul 13, 2020 at 8:53
\$\endgroup\$
11
  • 4
    \$\begingroup\$ Is it kolmolgorov complexity? \$\endgroup\$ Commented Jul 13, 2020 at 9:07
  • 3
    \$\begingroup\$ [kolmogorov-complexity] is a tag for challenges that have no input and a fixed output. The name comes from theoretical computer science. \$\endgroup\$ Commented Jul 13, 2020 at 9:19
  • 2
    \$\begingroup\$ Looks pretty boring. Can anyone beat Bubblegum? \$\endgroup\$ Commented Jul 13, 2020 at 11:39
  • 1
    \$\begingroup\$ @user202729 How many bytes is that anyway? By comparison, Charcoal's compression takes 85 bytes. \$\endgroup\$ Commented Jul 13, 2020 at 12:09
  • 1
    \$\begingroup\$ @Neil I got 85 bytes in Bubblegum (zopfli) as well. \$\endgroup\$ Commented Jul 13, 2020 at 15:46

7 Answers 7

5
\$\begingroup\$

05AB1E, 91 bytes

•Eó£ƵZ3|ã
xWм7qèý`ÚA¿нÏ9,ÖcPÇŸ›ÎŸt¤,,ûUÅ ̈ù—¤ï`ÿ3⁄4ζ@η@••71⁄4P•в•pÏ{ʒÂfĆ ̈¿ZF•15вú•DŠ\•4в£»31DT/:

Try it online.

Explanation:

•Eó£ƵZ3|ã
xWм7qèý`ÚA¿нÏ9,ÖcPÇŸ›ÎŸt¤,,ûUÅ ̈ù—¤ï`ÿ3⁄4ζ@η@•
 # Push compressed integer 31746388586852694571167828992290814184914816000404856451284780420784056983357043462437313025051647834765116670748406087616
 •71⁄4P• # Push compressed integer 502885
 в # Convert the larger integer to base-502885 as list:
 # [59,0,64,230781,314159,26,502884,535,83279,1971,89,433,6939,79,44,937,323,749,510,84,58209,626]
•pÏ{ʒÂfĆ ̈¿ZF• # Push compressed integer 60230047425392376760356855
 15в # Convert it to base-15 as list:
 # [12,1,1,14,0,6,5,5,0,4,3,0,13,7,3,8,7,3,4,4,11,0]
ú # Pad the integers in the first list with leading spaces,
 # where the amount of spaces is that of the second list at the same indices:
 # [" 59"," 0"," 64"," 230781","314159"," 26"," 502884"," 535","83279"," 1971"," 89","433"," 6939"," 79"," 44"," 937"," 323"," 749"," 510"," 84"," 58209","626"]
•DŠ\• # Push compressed integer 880633
 4в # Convert it to base-4 as list: [3,1,1,2,3,3,3,3,2,1]
 £ # Split the list of strings into parts of that size:
 # [[" 59"," 0"," 64"],[" 230781"],["314159"],[" 26"," 502884"],[" 535","83279"," 1971"],[" 89","433"," 6939"],[" 79"," 44"," 937"],[" 323"," 749"," 510"],[" 84"," 58209"],["626"]]
 » # Join each inner list by spaces, and then each string by newlines
31 # Push 31
 D # Duplicate it
 T/ # Divide the copy by 10: 3.1
 : # Replace the "31" with "3.1" in the string
 # (after which the result is output implicitly)

Note that all the leading spaces (except for the first integers in the line) are decreased by 1 because the » joins by spaces.

See this 05AB1E tip of mine (section How to compress large integers? and How to compress integer lists?) to understand how the compressed parts works.


Since I was curious, I also made a program using the actual PI-digits and drawing them in the specified pattern one by one using the Canvas builtin Λ. Which surprisingly enough is not that much larger (97 bytes ):

2žs•3]]\ ́ë:O•23в£J•ΘüÁи‘•11в0šúS•2q4Beçq̧ßI/ÖÅ? ×ばつΣ3ÛuÌÎvêmtTYx¡n‡¢lΛf4ÙI1¿çÑv•9в.Λ46Â:„ 4„3..;

Try it online.

Explanation:

2 # Push a 2
žs # Push an infinite list of PI digits: [3,1,4,1,5,...]
 •3]]\ ́ë:O• # Push compressed integer 243177533433411924
 23в # Convert it to base-23 as list: [11,2,5,2,3,22,3,3,5,3,2,10,1]
 £ # Split the PI-digits into parts of that size
 J # Join each inner list of digits together:
 # [31415926535,89,79323,84,626,4338327950288419716939,937,510,58209,749,44,5923078164,0]
•ΘüÁи‘• # Push compressed integer 342434478685
 11в # Convert it to base-11 as list: [1,2,2,2,5,3,3,7,7,1,10,2]
 0š # Prepend a 0: [0,1,2,2,2,5,3,3,7,7,1,10,2]
 ú # Pad the strings with that many leading spaces to the integers:
 # ["31415926535"," 89"," 79323"," 84"," 626"," 4338327950288419716939"," 937"," 510"," 58209"," 749"," 44"," 5923078164"," 0"]
 S # And convert it to a flattened list of characters
•2q4Beçq̧ßI/ÖÅ? ×ばつΣ3ÛuÌÎvêmtTYx¡n‡¢lΛf4ÙI1¿çÑv•
 # Push compressed integer 1107440116348129217561550864085059321059233554362962027078200378907904337318203317830295973758995759889862300097
 9в # Convert it to base-9 as list:
 # [2,2,2,2,2,4,2,4,6,6,6,5,2,2,3,2,2,3,6,6,6,6,5,2,5,6,6,6,6,1,1,1,2,1,2,2,2,1,2,2,2,2,1,2,2,2,2,2,4,2,2,2,3,2,2,2,5,6,6,2,2,2,5,6,6,6,2,2,5,6,6,6,6,6,2,6,2,2,2,2,7,6,6,6,6,6,6,6,2,2,7,6,6,8,1,1,2,2,2,2,2,2,2,2,2,2,3,2,2,2,2,2,1,6,6,6,6]
.Λ # Use the Canvas builtin with these three lists, where
 # - the 2 is the length of each line
 # - the list ["3","1","4",...," "," ","0"] are the characters to draw
 # - the list [2,2,2,...,6,6,6] are the directions
 46 # Push 46
 Â # Bifurcate it (short for Duplicate & Reverse copy): 64
 : # Replace the 46 with 64 in the string
 „ 4„3..; # Replace the first " 4" with "3."
 # (after which the result is output implicitly)

See this 05AB1E tip of mine (section How to compress large integers? and How to compress integer lists?) to understand how the compressed parts works.

So we use the following options for the Canvas builtin:

  • \$a\$ length: 2 (all lines are of size 2; or basically 1 since they're overlapping previous lines)
  • \$b\$ the characters we want to display, which are the digits of PI with the spaces we added to travel around
  • \$c\$ the directions, where 8 is a reset to the origin where we started, and the other directions are:
7 0 1
 ↖ ↑ ↗
6 ← X → 2
 ↙ ↓ ↘
5 4 3

Here some of the first steps:

char: 3; direction: 2→
3
char: 1; direction: 2→
31
char: 4; direction: 2→
314
char: 1; direction: 2→
3141
char: 5; direction: 2→
31415
char: 9; direction: 2→
314159
char: 2; direction: 4↓
314159
 2
char: 6; direction: 2→
314159
 26
char: 5; direction: 4↓
314159
 26
 5
char: 3; direction: 6←
314159
 26
 35
char: 5; direction: 6←
314159
 26
 535
char: space; direction: 6←
314159
 26
 535
char: 8; direction: 5↙
314159
 26
 535
 8
char: 9; direction: 2→
314159
 26
 535
 89
etc.

Also note how I take advantage of the palindromized part 535 here so I'm able to draw those digits backwards. With most other digit-substrings I have to first go to the correct position with spaces before drawing the actual digits in direction 2→.
I use this same palindroized approach also for the digit-substrings 323 and 626.

The reason the first 3 of the PI-digits is replaced with a 4 is because we use a length of 2 (since lines are overlapping), which causes a minor issue in this case when we reset to the origin location with 'direction' 8. Since we had to insert the dot anyway this doesn't really matter too much.
The 46 to 64 is because we couldn't move around to the next section with spaces like we did with all the other digits for the final 0, since it's encapsulated inside other digits and we can't reach it.

See this 05AB1E tip of mine for an in-depth explanation of how the Canvas builtin works.

answered Jul 13, 2020 at 13:17
\$\endgroup\$
2
\$\begingroup\$

JavaScript (ES8), (削除) 156 152 (削除ここまで) 151 bytes

_=>`Qk2 SH
2755Q
1C.4USW
Bq4SGG6
6LxSK4xOC5
13n5Ch2DOE
ZbJoBKP
3Zr990 6AS
11gJYN0
7Q8`.replace(/[0-Z]+\w?/g,s=>''.padEnd((n=parseInt(s,36))%16)+(n>>4))

Try it online!

How?

A group of \$k\$ spaces followed by a number \$N\$ is encoded as \16ドルN+k\$ in base 36 and upper case.

Example:

" 59" -> 16 * 59 + 12 = 956 -> "QK"

The following rules apply to separate a string from the next one:

  • If it's followed by a line-feed or a period, we leave it as-is.
  • If it ends with a letter, we put it in lower case.
  • Otherwise, we use one of the spaces that should have been encoded in the next group as a separator.

As a result, all strings can be unambiguously matched with /[0-Z]+\w?/.

answered Jul 13, 2020 at 9:15
\$\endgroup\$
2
\$\begingroup\$

05AB1E, 111 bytes

•DIÿ5εïΩǝ>Î*.}Öδμ1⁄4ËüúMeĀ¡ζ¿†)в¡Óa×ばつa¿ǝ¬=ß/L@&„@’...ë1⁄4ïæW5éÓ#c∞ðbΣh¬Á‚q"›?иøç,G$X•12B'§Åu„ 
‡31DT/:

Try it online!

•...•12B'§Åu„ \n‡31DT/: # trimmed program
 : # replace...
 31 # literal...
 : # with...
 31 # literal...
 D / # divided by...
 T # 10...
 : # in...
 ‡ # replaced each character of...
 '§Å # "ab"...
 u # in uppercase...
 ‡ # with corresponding character of...
 „ \n # literal (\n is newline)...
 ‡ # in...
•...• # 12929493392715033775373083693785395621840635578238991913835355382477224495770768407855388223047936086665789536281935915002520324655471900188866985320315060383798192979161318650352714212687144153060399193782953565620356798...
 B # converted to base...
 12 # literal
 # implicit output
answered Jan 13, 2021 at 18:29
\$\endgroup\$
1
\$\begingroup\$

///, 147 bytes

/a/ //b/ 5/a b9 0 64
aaa 230781
3.14159
a 26 b02884
b35 83279a 1971
 89 433aaa 6939
a 79a44aa 937
a 323a749b10
a84a b8209
626

Try it online!

answered Jul 13, 2020 at 10:06
\$\endgroup\$
1
  • \$\begingroup\$ 141 bytes \$\endgroup\$ Commented Jul 13, 2020 at 16:20
1
\$\begingroup\$

Retina 0.8.2, 122 bytes


l59b0b64¶n230781¶3.14159¶f26f502884¶e535a83279e1971¶c89a433n6939¶g79d44i937¶g323d749e510¶d84l58209¶626
{`[a-z]
 $&
T`l`_l

Try it online! Uses letters to run-length encode spaces. (The as could be spaces but I couldn't be bothered to special-case them in the encoder.)

answered Jul 13, 2020 at 12:18
\$\endgroup\$
1
\$\begingroup\$

Perl + -p, 117 bytes

This program contains unprintables so the TIO link is to a Bash program that loads the program from a reversible hex dump.

}{s//
 u0z
Q0�1
3.HI9
TlV�
o5�U9M�
�e3a
�f	�7
Z3�9m0
�
 tN9
x6/;s/[^\d
.]/15>($x=ord$&)?$"x$x:$x-58/ge

Try it online!

This was generated using the following program which uses RLE for spaces and stores runs of digits as bytes where possible.

answered Jul 13, 2020 at 10:26
\$\endgroup\$
1
\$\begingroup\$

Deadfish~, 842 bytes

{i}cc{i}{i}ii{c}cc{i}{i}iciiiic{d}{d}dddddcc{i}iiiiiic{d}ddddddcc{i}{i}iicddc{{d}iiiiii}ddc{i}{i}ii{c}cccc{i}{i}ddcicdddc{i}dddcic{d}iiic{{d}iiiiii}ic{{i}dddddd}icdddddciiiciiicdddciiiiciiiic{{d}iiiii}iiic{i}{i}iicccccc{i}{i}ddciiiic{d}{d}ddcccccc{i}{i}icdddddciiciiiiiiccddddc{{d}iiiiii}ddc{i}{i}iiccccc{i}{i}icddciic{d}{d}dc{i}{i}iiiicdddddcdciiiiiciic{d}{d}dddddccccc{i}{i}dddc{i}ddcddcddddddc{{d}iiiiii}ic{i}{i}iiccc{i}{i}iiiicic{d}{d}dddddc{i}{i}cdcc{d}{d}i{c}cccc{i}{i}iiciiicddddddciiiiiic{{d}iiiii}iiic{i}{i}iiccccccc{i}{i}iiiciic{d}{d}dddddcccc{i}{i}cc{d}{d}ccccccccc{i}{i}iiiiicddddddciiiic{{d}iiiiii}dddddc{i}{i}iiccccccc{i}{i}dcdcic{d}{d}icccc{i}{i}iiicdddciiiiic{d}{d}dddddccccc{i}{i}icddddcdc{{d}iiiiii}iic{i}{i}iicccc{i}{i}iiiicddddc{d}{d}{c}cc{i}{i}iciiicddddddcddc{i}dc{{d}iiiii}iiic{{i}dddddd}iiiicddddciiiic{{d}iiiiii}ddddc

Try it online!

The longest answer so far, and proud of it.

answered Feb 24, 2021 at 8:59
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.