# Output the Trinity Hall Prime

Based on this Math.SE question; number copied from this answer. Number originally from a Numberphile video, of course.

888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888111111111111111111111111888888111111111111111111111111888888111111811111111118111111888888111118811111111118811111888888111188811111111118881111888888111188811111111118881111888888111888811111111118888111888888111888881111111188888111888888111888888111111888888111888888111888888888888888888111888888111888888888888888888111888888111888888888888888888111888888811188888888888888881118888188811188888888888888881118881188881118888888888888811188881118888111888888888888111888811111888811118888888811118888111111188881111111111111188881111111118888111111111111888811111111111888811111111118888111111111111188881111111188881111111111111118888811118888811111111111111111888881188888111111111111111111118888888811111111111111111111111888888111111111111111111111111118811111111111111111111111111111111111111111111062100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001


You may optionally include newlines in the output.

# Rules

• This is , so no input.
• Your program must terminate within one hour on a standard computer - if it is close, I will use mine for testing. If your program runs for more than minute, or does not terminate on TIO, please include the time on your computer.
• This is , so shortest code, in bytes, wins.
• "number originally from a numberphile video" i think it's originally from professor mckee :P – undergroundmonorail Sep 10 '17 at 16:30

# Jelly, 74716968 66 bytes

“©ạ-3ṗÇñ"ỤḍV8żṢ?ḤsMVE[,Ṃƭ"ḞÇsẇʂ(ụFsẠʂẆŀṣ’ḃ19ĖŒṙị⁾81s30m0Z062 ȷ446‘


Try it online!

### How it works

The literal “©ạ-3ṗÇñ"ỤḍV8żṢ?ḤsMVE[,Ṃƭ"ḞÇsẇʂ(ụFsẠʂẆŀṣ’ replaces all characters with their code points in Jelly's code page and interprets the result as a (bijective) base-250 number, yielding the following integer.

103877200905186099028820568168804302565394743652609510039112658230540917082292838565138059974


Then, ḃ19 converts this number to bijective base 19, yielding the following digit array.

16,14,18,12,19,11,3,12,5,10,3,14,4,9,3,15,4,8,3,6,6,4,4,7,3,4,10,3,4,6,3,3,12,3,4,5,3,2,14,3,4,4,3,7,9,4,3,4,3,8,9,4,3,3,3,9,8,4,4,2,3,9,8,5,3,2,3,9,8,6,3,1


Now, ĖŒṙ enumerates the digits and performs run-length decoding, yielding the following array.

1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,14,14,14,14,14,14,14,14,14,15,15,15,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,18,18,18,18,19,19,19,20,20,20,20,20,20,21,21,21,21,21,21,22,22,22,22,23,23,23,23,24,24,24,24,24,24,24,25,25,25,26,26,26,26,27,27,27,27,27,27,27,27,27,27,28,28,28,29,29,29,29,30,30,30,30,30,30,31,31,31,32,32,32,33,33,33,33,33,33,33,33,33,33,33,33,34,34,34,35,35,35,35,36,36,36,36,36,37,37,37,38,38,39,39,39,39,39,39,39,39,39,39,39,39,39,39,40,40,40,41,41,41,41,42,42,42,42,43,43,43,44,44,44,44,44,44,44,45,45,45,45,45,45,45,45,45,46,46,46,46,47,47,47,48,48,48,48,49,49,49,50,50,50,50,50,50,50,50,51,51,51,51,51,51,51,51,51,52,52,52,52,53,53,53,54,54,54,55,55,55,56,56,56,56,56,56,56,56,56,57,57,57,57,57,57,57,57,58,58,58,58,59,59,59,59,60,60,61,61,61,62,62,62,62,62,62,62,62,62,63,63,63,63,63,63,63,63,64,64,64,64,64,65,65,65,66,66,67,67,67,68,68,68,68,68,68,68,68,68,69,69,69,69,69,69,69,69,70,70,70,70,70,70,71,71,71,72


Then, ị⁾81 indexes into the string 81, replacing odd numbers with the character 8, even number with the character 1. Afterwards, s30 splits the result into chunks of length 30. Displaying one chunk per line, the result looks as follows.

888888888888888811111111111111
888888888888888888111111111111
888888888888888888811111111111
888111111111111888881111111111
888111111111111118888111111111
888111111111111111888811111111
888111111888888111188881111111
888111188888888881118888111111
888111888888888888111888811111
888118888888888888811188881111
888111111188888888811118881111
888111111118888888881111888111
888111111111888888881111888811
888111111111888888881111188811
888111111111888888881111118881


Now, m0 concatenates the array of chunks with a reversed copy of itself. Afterwards, Z zips the result, transposing rows and columns.

888888888888888888888888888888
888888888888888888888888888888
888888888888888888888888888888
888111111111111111111111111888
888111111111111111111111111888
888111111811111111118111111888
888111118811111111118811111888
888111188811111111118881111888
888111188811111111118881111888
888111888811111111118888111888
888111888881111111188888111888
888111888888111111888888111888
888111888888888888888888111888
888111888888888888888888111888
888111888888888888888888111888
888811188888888888888881118888
188811188888888888888881118881
188881118888888888888811188881
118888111888888888888111888811
111888811118888888811118888111
111188881111111111111188881111
111118888111111111111888811111
111111888811111111118888111111
111111188881111111188881111111
111111118888811118888811111111
111111111888881188888111111111
111111111118888888811111111111
111111111111888888111111111111
111111111111118811111111111111
111111111111111111111111111111


0 is an unparsable nilad, so the result from before is printed (without line breaks) and the return value is set to 0.

62 is another unparsable nilad, so the result from before (0) is printed and the return value is set to 62.

ȷ446 is yet another unparsable nilad. 62 is printed and the return value is set to 10446.

Finally, ‘ increments the result. The final result (10446 + 1) is printed when the program finishes.

• ooo cool please add an explanation :D – hyper-neutrino Sep 8 '17 at 1:40
• @HyperNeutrino based on the output (but with my complete lack of Jelly knowledge), there's some mirroring going on or something like that – Stephen Sep 8 '17 at 1:45
• @Stephen Well I mean first it's some fancy number and then conversion into "bijective base something" (whatever that means, I'll go figure that out), and then enumerate, and then run-length, and then index into [8, 1]... Oh, that's smart! I'm stealing this trick I hope you don't mind :))) and then yeah add all that weird 06210..01 stuff. nice :) – hyper-neutrino Sep 8 '17 at 1:57
• @HyperNeutrino Added an explanation. – Dennis Sep 8 '17 at 2:06
• Up voted for the "graphics" alone. This is pretty sweet, wish I understood Jelly :) – pinkfloydx33 Sep 9 '17 at 10:35

# SOGL V0.12, 817875 73 bytes

$!╚Qαūπōθ(└↓Υ8Π⁶!√|ΠΚψ░⅜Υ‛⁷>∙↓ts3]δεΧ‰“8«─'½Κ81¹¹I⌡_¹◄ø∑'¹n╬³0621"η“⌡01⁰∑  Try it Here! Explanation: ...“ push a big number of the RLE lengths of the top part 8«─ convert from base 10 to base 16 (15 was the max length, and making it base 15 wasn't worth it) '½Κ prepend to the array 48 81¹ push [8, 1] ¹ wrap those two in an array I rotate clockwise, resulting in [[8, 48], [1, 2], [8, 9], [1, 12], ...] ⌡_¹ flatten (iterate over, splat current items contents on stack, collect the contents in an array) ◄ run-length decode ø∑ join as a string '¹n split into lines of length 15 ╬³ palindromize horizontally with no overlap 0621 push 0, 6, 2, and 1 "η“ push 445 ⌡ that many times do 0 push 0 1 push 1 ⁰∑ join the stack together in a string  # Jelly, 136 bytes “ßṪṭAƭẠvµM⁾ṖOḥ⁻Ɠ×Ṣ~*pṭẒFỵṿ¦4ÇḟọLÑOcKɲ⁶2*Ḣɲ’b45;@€1ẋ/€ø“Œ\⁴rrNỊġ:,xƙŒ#ṠƲQçḷĠ%&⁻ɼiḂŀB<Ȧƈg(Ṇb>TḥḄ|ḃṘƬ#l7ƇØṃ’b94;@€8ẋ/€ðżF;0;6;2;1;0ẋ445¤;1Ḍ  Try it online! # Explanation (numbers shortened) “ßṪṭ...*Ḣɲ’b45;@€1ẋ/€ø“Œ\⁴...ƇØṃ’b94;@€8ẋ/€ðżF;0;6;2;1;0ẋ445¤;1Ḍ Main link “ßṪṭ...*Ḣɲ’b45;@€1ẋ/€ Run-length encoded 1s “ßṪṭ...*Ḣɲ’ The base-45 encoding of the list of the run-lengths of 1s b45 in base 45 € For each element ;@ prepend 1 1 € For each sublist / Reduce over ẋ Repeat list (this gets a bunch of lists of 1s) ø“Œ\⁴...ƇØṃ’b94;@€8ẋ/€ Run-length encoded 8s “Œ\⁴...ƇØṃ’ The base-94 encoding of the list of the run-lengths of 8s b94 in base 94 € For each element ;@ prepend 8 8 € For each sublist / Reduce over ẋ Repeat list (this gets a bunch of lists of 8s) ðżF;0;6;2;1;0ẋ445¤;1Ḍ With both of the previous lists of lists, construct the final string ż Interleave them F Flatten it ;0 Append 0 ;6 Append 6 ;2 Append 2 ;1 Append 1 ; Append 0ẋ445¤ (Nilad) 0 0 ẋ445 445 times ;1 Append 1 Ḍ Convert decimal digits to a number  -121 bytes thanks to Dennis using “...’ literals instead of normal numbers • “...’ literals save a bunch of bytes. tio.run/… – Dennis Sep 8 '17 at 0:52 • @Dennis Oh geez that is even more unreadable. Beautiful! Thanks! :D – hyper-neutrino Sep 8 '17 at 0:57 • 0;6;2;1; seems awfully wordy. – Magic Octopus Urn Sep 8 '17 at 15:40 • @MagicOctopusUrn Yeah I could probably shorten it quite a bit; I'll look into that sometime :P – hyper-neutrino Sep 8 '17 at 16:35 # Jelly, 133 84 73 bytes “÷iþṃL7[ḲʂƘⱮ=ƬƤ¬RẹŀẹY÷n£ị€ıø&ḟ"gPƲ_ÇḊṪ’b⁴48;ĖŒṙḂ×7‘s15m€0F;“¡©£¢‘Ḍ×ȷ446‘  Try it online! (footer formats the decimal number with the dimensions that yield the coat of arms). ### How? A run-length encoded form of a binary format of the left-side of the coat of arms' 8s and 1 up to the row before the one starting 0621 reflected with the 0621 added and then multiplied up by 10446 and incremented. “...’b⁴48;ĖŒṙḂ×7‘s15m€0F;“¡©£¢‘Ḍ×ȷ446‘ - Link: no arguments “...’ - base 250 number b⁴ - to base 16 48; - prepend a 48 Ė - enumerate [[1,48],[2,12],[3,3],[4,12],[5,3],... Œṙ - run-length decode (48 1s then 12 2s then ...) Ḃ - modulo by 2 (vectorises) evens->0 odds->1 ×7 - multiply by 7 (vectorises) ‘ - increment (vectorises) - now all 8s and 1s s15 - split into chunks of length 15 m€0 - reflect each chunk F - flatten “¡©£¢‘ - code-page indices = [0,6,2,1] ; - concatenate Ḍ - from decimal list to number ȷ446 - 10^446 × - multiply ‘ - increment  # Charcoal, 107104989687 79 bytes Ｅ³⁰✂”}∧Pt→8⌕ＬＪε‽∨↑¬KαfＧⅉKＭκ⎆wp◧⪫⊘^≦#⁸¹"π✂×OγX‹nI”×ι¹⁵×⊕ι¹⁵‖ＣＭ²⁸←621Ｍ²⁵¦¹⁴1ＵＢ0  Try it online! Link to verbose code for explanation # Proton, 368 bytes s=(map("8"&(*),[93,6,6,1,1,6,2,2,6,3,3,6,3,3,6,4,4,6,5,5,6,6,6,6,18,6,18,6,18,7,16,4,3,16,3,4,14,4,4,12,4,4,8,4,4,4,4,4,4,4,4,4,5,5,5,5,8,6,2]),map("1"&(*),[24,24,6,10,6,5,10,5,4,10,4,4,10,4,3,10,3,3,8,3,3,6,3,3,3,3,3,3,3,3,3,1,3,3,2,3,3,3,3,3,5,4,4,7,14,9,12,11,10,13,8,15,4,17,2,20,23,26,44])) q=''.join(s[0][i]+s[1][i]for i:0..len(s[0])) print(q+'0621'+'0'*445+'1')  Try it online! # Python 2, 760523329205 196 bytes -237 bytes thanks to Stephen. -124 bytes thanks to Jonathan Frech. print''.join((ord(j)-34)*'81'[i%2]for i,j in enumerate(":(:((#,#(('$,$'(&%,%&(&%,%&(%&,&%(%'*'%(%(((%(%4%(%4%(%4%)%2%&#%%2%%$&%0%&%&%.%&'&&*&&)&0&+&.&-&,&/&*&1'&'3'$'6*9(<$N"))+'0621'+'0'*445+'1'


Try it online!

• 526 bytes by declaring variables for 8 and 1 and combining 621 – Stephen Sep 8 '17 at 0:12
• Oh. XD I just automated it, so I didn't see the 621. Thanks! – totallyhuman Sep 8 '17 at 0:14
• 205 bytes by compressing the list. A few more if you only want to use printable bytes. – Jonathan Frech Sep 8 '17 at 3:31

# Ruby, 180 bytes

s=0;"".unpack('H*')[0].split(?f).map{|a|a.chars.map{|c|s^=2**c.to_i(16)};t=("%015b"%s).gsub ?0,?8;$><<t+t.reverse};puts'0621'+?0*445+?1  Try it online! 178 bytes + 2 bytes for -Kn (forces ASCII encoding.) 43 mostly unprintable characters in between the first quotes. Hexdump: 00000000: 733d 300a 22ff f012 3456 789a bff5 f6f7 s=0."...4Vx..... 00000010: ff8f 4f3f 012f ff8b fef7 af69 df45 8cf0 ..O?./.....i.E.. 00000020: 1237 bf6a f59f 48f2 37f1 6f04 5f3f 12f0 .7.j..H.7.o._?.. 00000030: 222e 756e 7061 636b 2827 482a 2729 5b30 ".unpack('H*')[0 00000040: 5d2e 7370 6c69 7428 3f66 292e 6d61 707b ].split(?f).map{ 00000050: 7c61 7c61 2e63 6861 7273 2e6d 6170 7b7c |a|a.chars.map{| 00000060: 637c 735e 3d32 2a2a 632e 746f 5f69 2831 c|s^=2**c.to_i(1 00000070: 3629 7d3b 743d 2822 2530 3135 6222 2573 6)};t=("%015b"%s 00000080: 292e 6773 7562 203f 302c 3f38 3b24 3e3c ).gsub ?0,?8;$><
00000090: 3c74 2b74 2e72 6576 6572 7365 7d0a 7075  <t+t.reverse}.pu
000000a0: 7473 2730 3632 3127 2b3f 302a 3434 352b  ts'0621'+?0*445+
000000b0: 3f31                                     ?1


# How?

Everyone else was doing run length encoding, so I wanted to try something different.

The formatted "picture" version of the prime can be separated into two parts - a 30x30 grid of 8's and 1's, and a second section of mostly zeros which can be hardcoded. Focusing on the first part, we observe that it's symmetrical down the center, so if we can produce the left half then we can just print half of each line with its reverse.

Half of one line is 15 characters long. If we replace the 8's with zeros, each line can be interpreted as a 15-bit binary number. Conveniently, for the most part the edit distance between each consecutive line is small, so I decided to implement my solution by storing the first line s (888888888888888, which just becomes 0) and applying a series of bit flipping operations on s, printing the result each time.

Since each line is 15 bits long, I encoded these operations as hexadecimal digits - for example, if the operation is b (or 11), then we flip bit 11. Some lines differ by more than one bit, so they require a string of hexadecimal digits. We have one bit left over (f) so we can use it as a delimiter between these strings, and also as a "do nothing" value. Example below (you can see these lines in the post referenced in the question):

Line 3: 000000000000000
Line 4: 000111111111111  <-- flip bits 0 through b
Line 5: 000111111111111  <-- do nothing
Line 6: 000111111011111  <-- flip bit 5


To put that all together, we would encode 0123456789ab, then separate with f, do nothing with f, then 5. This works because we're going to do .split(?f) later to get each set of operations by line, which will yield ["0123456789ab", "", "5"], and "" will be a no-op.

The difference between lines 3 and 4 above is by far the longest set of edits, and the edit distance between any two consecutive lines is usually 0-2, so I would say that this encoding is reasonably inexpensive, although I'm sure it can be improved.

The entire encoded string ends up being fff0123456789abff5f6f7ff8f4f3f012fff8bfef7af69df458cf01237bf6af59f48f237f16f045f3f12f0 (86 bytes), which will get the entire 30x30 grid. But we're not done yet...

Hexadecimal digits can be represented by 4 bits (b -> 1100, etc.) That means that if we're willing to encode our string 4 bits at a time rather than using bytes, we can cut the length of the string in half. So that's what I did - the hexdump shows the string represented in 43 bytes. After that, it's just a matter of using Ruby's nifty String#unpack with H* (interpret as hex string, high nibble first) to expand the 43-byte string into the 86-byte version we know and love, and looping over each set of operations flipping bits - for our stored string s and an operation c we do s ^ 2**c.to_i(16) to flip the corresponding bit.

After each set of edits is completed, we pad the resulting binary to 15 bits, switch all of the 0's back to 8's, and print the result and its reverse. As noted before, the part of the number after the 30x30 grid can be hardcoded, so we do that as puts'0621'+?0*445+?1.

The final encoded string has no possibility of working on TIO, so the TIO version uses escapes, which still works but is longer.

".$MBZp&8OIoLs7Rv/BEqN#1r~E$O%6^UO=\z:(Iw]l\LQ.g.aWf+{2;on|YP'y$:Lc$i$GMCg&mRs#y0*zZ,C|Hf6;b/o-0|FNK5R:OIi}{'CJ}LOXMSA,&vzl5scm5y0{om=A_#/wF"'#fm92bs:A;"6NLkB)h%@{uhp_v+YK"'#fm92bYb2f+{[A/(\s:A;)]}%e~'0445*1 Try it Online Run-length encoding expanded from base 92 (Base 250 led to multibyte chars so had to adjust). Also, 4341089843357287864910309744850519376 is expanded from base 92 and converted to binary. A 1 means the run-length is two digits, 0 means it's one digit. For example, the first 4 digits of the binary representation are 1101 because the first four runs are [93,8],[24,1],[6,8],[24,1] (93 8's, 24 1's, etc...) # JavaScript, 454450332207 204 bytes -4 bytes thanks to Stephen. -125 bytes thanks to Shaggy and Dom Hastings. _=>[...] ,].map((j,i)=>'81'[i%2].repeat(j.charCodeAt())).join+0+621+"0".repeat(445)+1  There's a boatload of unprintables in this answer, so here's a hexdump: 00000000: 5f3d 3e5b 2e2e 2e60 5d18 0618 0606 010a _=>[...]....... 00000010: 0106 0605 020a 0205 0604 030a 0304 0604 ................ 00000020: 030a 0304 0603 040a 0403 0603 0508 0503 ................ 00000030: 0603 0606 0603 0603 1203 0603 1203 0603 ................ 00000040: 1203 0703 1003 0401 0303 1003 0302 0403 ................ 00000050: 0e03 0403 0403 0c03 0405 0404 0804 0407 ................ 00000060: 040e 0409 040c 040b 040a 040a 0408 040f ................ 00000070: 0504 0511 0502 0514 0817 061a 022c 605d .............,] 00000080: 2e6d 6170 2828 6a2c 6929 3d3e 2738 3127 .map((j,i)=>'81' 00000090: 5b69 2532 5d2e 7265 7065 6174 286a 2e63 [i%2].repeat(j.c 000000a0: 6861 7243 6f64 6541 7428 2929 292e 6a6f harCodeAt())).jo 000000b0: 696e 6060 2b30 2b36 3231 2b22 3022 2e72 in+0+621+"0".r 000000c0: 6570 6561 7428 3434 3529 2b31 epeat(445)+1  f= _=>[...] ,].map((j,i)=>'81'[i%2].repeat(j.charCodeAt())).join+0+621+"0".repeat(445)+1 document.write(f()) • I believe returning the value from a function would be valid. – Stephen Sep 8 '17 at 0:14 • Oh, right thanks. Could you please also do the HTML part? :P I seriously don't know a lot of this, I just picked JS because of the neat regex replace. EDIT: Thanks. :D – totallyhuman Sep 8 '17 at 0:19 • You can negate the quotes around the last +'1' as it's already a String and +'0621' can be +0+621! – Dom Hastings Sep 8 '17 at 8:26 • 222 bytes - Last one, I promise! – Shaggy Sep 8 '17 at 8:54 • [...] makes me so mad – ETHproductions Sep 8 '17 at 14:36 # JavaScript (ES6), 206205204203198197 194 bytes Came up with this while working on i cri everytim's solution, figured it was different enough to warrant posting on it's own. This includes a load of unprintables between the ] and the , so follow the TIO link below to view it with Unicode escapes (each sequence of \u followed by 4 digits counts as 1 byte). _=>],0621ƽ1.replace(/\D/g,(x,y)=>"810"[y<122?y&1:2].repeat(x.charCodeAt()))  Try it online # MATLAB/Octave, 319 318 bytes This is my first attempt at this challenge. Still a bit large and there are probably more efficient ways of doing it, but I thought I'd post it anyway as the method was more interesting than just zipping it. for i=reshape('|871%871%8%1 8)1 8%1%8$1!8)1!8$1%8#1"8)1"8#1%8#1"8)1"8#1%8"1#8)1#8"1%8"1$8''1$8"1%8"1%8%1%8"1%8"118"1%8"118"1%8"118"1&8"1/8"1#8 1"8"1/8"1"8!1#8"1-8"1#8"1#8"1+8"1#8$1#8#1''8#1#8&1#8-1#8(1#8+1#8*1#8)1#8,1#8''1#8.1$8#1$801$8!1$831''861%891!8K1 0 6 2 1~0~0~0~00 1',2,[]);fprintf(repmat(i(2),1,i(1)-31));end


Try it online!

The method used here is to make use of a Run-Length-Encoding scheme of sorts.

We start off with the original number and count the number of consecutive digits. These are written in the result below as the count followed directly by the digit (space separated for clarity).

938 241 68 241 68 61 8 101 8 61 68 51 28 101 28 51 68 41 38 101 38 41 68 41 38 101 38 41 68 31 48 101 48 31 68 31 58 81 58 31 68 31 68 61 68 31 68 31 188 31 68 31 188 31 68 31 188 31 78 31 168 31 48 1 38 31 168 31 38 21 48 31 148 31 48 31 48 31 128 31 48 51 48 41 88 41 48 71 48 141 48 91 48 121 48 111 48 101 48 131 48 81 48 151 58 41 58 171 58 21 58 201 88 231 68 261 28 441 0 6 2 1 4450 1


If any of the values is larger than 95 we break that up into multiple chunks of 95 or less - this only happens for the 445 0's which instead becomes four sets of 95 0's and a set of 65 0's. We also pad any counts that are less than 10 with a 0 to make all elements three characters long. This yields with the spaces removed:

938241068241068061018101018061068051028101028051068041038101038041068041038101038041068031048101048031068031058081058031068031068061068031068031188031068031188031068031188031078031168031048011038031168031038021048031148031048031048031128031048051048041088041048071048141048091048121048111048101048131048081048151058041058171058021058201088231068261028441010016012011950950950950650011


In hindsight at this point I could have done this step before merging it all together, but ho hum you live and learn. We do something clever which is to take the count for each group (2 digits) and we add 31. Because all of them are <96, the resulting number is the ASCII value for a printable character (32 to 126). Giving us counts of:

|7%7%% ) %%$!)!$%#")"#%#")"#%"#)#"%"$'$"%"%%%"%"1"%"1"%"1"&"/"# ""/""!#"-"#"#"+"#$##'##&#-#(#+#*#)#,#'#.$#$0$!$3'6%9!K ~~~~  After a bit of reshaping in MATLAB to make it more favourable for decoding, and then also escaping ' characters with '' (otherwise MATLAB splits string literals there), we are left with the clever string: |871%871%8%1 8)1 8%1%8$1!8)1!8$1%8#1"8)1"8#1%8#1"8)1"8#1%8"1#8)1#8"1%8"1$8''1$8"1%8"1%8%1%8"1%8"118"1%8"118"1%8"118"1&8"1/8"1#8 1"8"1/8"1"8!1#8"1-8"1#8"1#8"1+8"1#8$1#8#1''8#1#8&1#8-1#8(1#8+1#8*1#8)1#8,1#8''1#8.1$8#1$801$8!1$831''861%891!8K1 0 6 2 1~0~0~0~00 1


That is the root of the code. In the code all I then do is reshape the array into a 2D string with 128 pairs of characters. For each pair the first character has 31 subtracted, and then the second character is displayed that many times.

The result is the original prime:

888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888111111111111111111111111888888111111111111111111111111888888111111811111111118111111888888111118811111111118811111888888111188811111111118881111888888111188811111111118881111888888111888811111111118888111888888111888881111111188888111888888111888888111111888888111888888111888888888888888888111888888111888888888888888888111888888111888888888888888888111888888811188888888888888881118888188811188888888888888881118881188881118888888888888811188881118888111888888888888111888811111888811118888888811118888111111188881111111111111188881111111118888111111111111888811111111111888811111111118888111111111111188881111111188881111111111111118888811118888811111111111111111888881188888111111111111111111118888888811111111111111111111111888888111111111111111111111111118811111111111111111111111111111111111111111111062100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001


Edits:

• rearranged the magic string so I could get rid of a transpose after the reshape. Saves a byte.

# 05AB1E, 76 bytes

•ŒÆÿ¹т£Ƶ‘β\,ä¸γλaXë«Š¸þaγG(žÃÇ…»šKþÈ/?'•20BS20öDg81s∍Ss×J30ôø.∞0D445×621s1J


Try it online!

Stole this from Dennis:

888888888888888811111111111111
888888888888888888111111111111
888888888888888888811111111111
888111111111111888881111111111
888111111111111118888111111111
888111111111111111888811111111
888111111888888111188881111111
888111188888888881118888111111
888111888888888888111888811111
888118888888888888811188881111
888111111188888888811118881111
888111111118888888881111888111
888111111111888888881111888811
888111111111888888881111188811
888111111111888888881111118881


Noticed it always alternates between 8 and 1, so I counted the lengths of each run (Base 20):

['G', 'E', 'I', 'C', 'J', 'B', '3', 'C', '5', 'A', '3', 'E', '4', '9', '3', 'F', '4', '8', '3', '6', '6', '4', '4', '7', '3', '4', 'A', '3', '4', '6', '3', '3', 'C', '3', '4', '5', '3', '2', 'E', '3', '4', '4', '3', '7', '9', '4', '3', '4', '3', '8', '9', '4', '3', '3', '3', '9', '8', '4', '4', '2', '3', '9', '8', '5', '3', '2', '3', '9', '8', '6', '3', '1']


Joined it all together, and converted it into a base-10 integer:

3954184379309026812828704944878416720438306456270310298603957651230861078960874182787979106461


Compressed it further into base-255:

ŒÆÿ¹т£Ƶ‘β\,ä¸γλaXë«Š¸þaγG(žÃÇ…»šKþÈ/?'


Then, after creating the compressed bit... We just have to manipulate it back to the original..

20B                                 # Back to base 20.
S                                # Each char separate...
20ö                             # As their base 10 values...
Dg81s∍                       # Extend '81' to the length of the array.
Ss×J                   # Push that many 8 or 1's as told by the array.
30ôø.∞             # Split by the symmetrical pattern, flip it, mirror.
0D445×621s1  # Create the part that doesn't fit into a pattern.
J # Join whole stack together.


# Final output:

88888888888888888888888888888
88888888888888888888888888888
88888888888888888888888888888
88811111111111111111111111888
88811111111111111111111111888
88811111181111111118111111888
88811111881111111118811111888
88811118881111111118881111888
88811118881111111118881111888
88811188881111111118888111888
88811188888111111188888111888
88811188888811111888888111888
88811188888888888888888111888
88811188888888888888888111888
88811188888888888888888111888
88881118888888888888881118888
18881118888888888888881118881
18888111888888888888811188881
11888811188888888888111888811
11188881111888888811118888111
11118888111111111111188881111
11111888811111111111888811111
11111188881111111118888111111
11111118888111111188881111111
11111111888881118888811111111
11111111188888188888111111111
11111111111888888811111111111
11111111111188888111111111111
11111111111111811111111111111
11111111111111111111111111111062100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001


# C (gcc), 277250 201 bytes

-27 bytes thanks to ceilingcat

n;f(i){for(i=0;n="oApYGYGGBKBGGFCKCFGEDKDEGEDKDEGDEKEDGDFIFDGDGGGDGDSDGDSDGDSDHDQDEBDDQDDCEDODEDEDMDEFEEIEEHEOEJEMELEKENEIEPFEFRFCFUIXG[Cm"[i++]%64;)for(;--n;)putchar(49+i%2*7);printf("0621%0446d",1);}


Try it online!

# Perl 5, 307 bytes

$d=1;print((map{($d^=9)x$_}(93,24,6,24,6,6,1,10,1,6,6,5,2,10,2,5,6,4,3,10,3,4,6,4,3,10,3,4,6,3,4,10,4,3,6,3,5,8,5,3,6,3,6,6,6,3,6,3,18,3,6,3,18,3,6,3,18,3,7,3,16,3,4,1,3,3,16,3,3,2,4,3,14,3,4,3,4,3,12,3,4,5,4,4,8,4,4,7,4,14,4,9,4,12,4,11,4,10,4,13,4,8,4,15,5,4,5,17,5,2,5,20,8,23,6,26,2,44)),0,621,0 x445,1)  Try it online! ## Bubblegum, 88 bytes 00000000: edc9 310a 0250 10c4 d02b fdb1 90dc ff64 ..1..P...+.....d 00000010: 96c1 80a2 8885 60aa d97d 7cb3 3de8 75c5 ........}|.=.u. 00000020: 37ab 820a 51ee 9537 942a 55c4 aaec 76b4 7...Q..7.*U...v. 00000030: cfb5 1cdc 33dd 908b ac1c 74a0 894e 03c8 ....3.....t..N.. 00000040: 11cc 99ab 9c1d c661 32c5 bad6 8aad 96d2 .......a2....... 00000050: b95e 76fe fd6e bb01 .^v..n..  Try it online! # Ruby, 194 bytes $><<?8+"~:(:((#,#(('$,$'(&%,%&(&%,%&(%&,&%(%'*'%(%(((%(%4%(%4%(%4%)%2%&#%%2%%$&%0%&%&%.%&'&&*&&)&0&+&.&-&,&/&*&1'&'3'$'6*9(<$N".bytes.reduce(""){|s,x|s+(s[-1]==?8??1:?8)*(x-34)}+"0621"+?0*445+?1  The upper part is RLE-encoded, the rest is simply hardcoded. Try it online! # Kotlin, 339 bytes val s="8J188J1888138<13881887148<14871886158<15861886158<15861885168<16851885178:178518851888188518851D8518851D8518851D8519851B85168315851B85158416851@85168516851>85168716861:861689168@168;168>168=168<168?168:168A1786178C1784178F1:8I188L148^130363231ǯ031" fun x()=(0..s.length-1 step 2).map{i->(1..(s[i].toInt()-50)).map{print(s[i+1])}}  Try it online! ## CJam (108 81 bytes) "u{èl>#ö^½³ó!;kMðSÀËndEyvY3ÉÊÅBà#®"256bFbee{)*~}%"81"f=15/_Wf%zT6Y446,:!1  Online demo In case character encoding borks the above, here it is xxd-encoded: 0000000: 2275 1e7b e86c 3e60 8d23 80f6 5ebd b3f3 "u.{.l>.#..^... 0000010: 213b 968d 6b4d f053 c0cb 6e64 1c45 7976 !;..kM.S..nd.Eyv 0000020: 5933 c9ca 8dc5 42e0 23ae 2232 3536 6246 Y3....B.#."256bF 0000030: 6265 657b 292a 7e7d 2522 3831 2266 3d31 bee{)*~}%"81"f=1 0000040: 352f 5f57 6625 7a54 3659 3434 362c 3a21 5/_Wf%zT6Y446,:! 0000050: 31 1  The initial run of 8s and 1s is split into just the left half and run-length encoded as just the lengths of alternating runs. Runs of more than 24 are split into runs of at most 24, separated by runs of 0, so that the lengths can be base-25 encoded and then base-256 encoded to pack them down. ## JavaScript (ES2017), 287 bytes _=>"00000000000000000027wr2027wr2027a9ko261b7c23jerc23jerc1yjm0o1y8coo1y2ou01xx5q01xx5q01xx5q00yykxc9ull699d4au9dk75xffo1v2fgptj4fh8jrj3hhwvgfhmlev3hour5rhq24n3hqytj3hr4hdrhr8ykfhra0hr".replace(/.{6}/g,n=>parseInt(n,36).toString(2).replace(/0/g,8).padStart(30,8))+0+621+"0".repeat(445)+1  Uses a slightly different approach to @icrieverytim's answer. -10 bytes thanks to @Shaggy's suggestion of using replace instead of match! f= _=>"00000000000000000027wr2027wr2027a9ko261b7c23jerc23jerc1yjm0o1y8coo1y2ou01xx5q01xx5q01xx5q00yykxc9ull699d4au9dk75xffo1v2fgptj4fh8jrj3hhwvgfhmlev3hour5rhq24n3hqytj3hr4hdrhr8ykfhra0hr".replace(/.{6}/g,n=>parseInt(n,36).toString(2).replace(/0/g,8).padStart(30,8))+0+621+"0".repeat(445)+1 ; p.innerHTML=f() pre{word-wrap:break-word;white-space:normal} <pre id=p></pre> • – Shaggy Sep 8 '17 at 8:59 # ///, 260 bytes /;/88%//:/1&13%13"//9/\/\///7/"1#95/!!!!94/%""93/8889-/000009,/11#9'/###9&/#88"9%/"""9#/389"/1119!/-----0/'''''''##8%4#;4&"8%18""&11;188"1::1&#%1#"&#8"",8"&&"&&'&&'&&'&#3"'#"#13"'#"3,"##&#"#"'"#",7#7"7%",%#%"#%,%1#%7"",4#8784,8,8%%,#%%",;411;%%41106215555!0001  Try it online! Nothing terribly interesting, just some compression. ## Mathematica, 192 bytes Uncompress["1:eJxTTMoP8nRjZWCwoCUwxAGIl0VSZIEhi2wEXAgma4Eqa0GCrAW6rAW6rAWyJKYsulPRGGhBRLksNmmYy/HJonkOXStWaeTwgTGQ5JADD4mJTQRdGo2PysUwC1kA0yJDFPdgJjWoKHZJNB/hlMYhaYiaMgkDAzMjQ4NRMHSBIQDgQA6C"]  # Python 2, 191190 188 bytes s='0621'+'0'*445+'1' a=1 for c in'L":&7(4%"%1%$%/$($-$*$+$,$)$.$\'$$($$%$#,#$#$#.#$"##0##!$#0#\'#2#&#2#&#2#&#&&&#&#%(%#&#$*$#&$#*#$&$#*#\$&%"*"%&&!*!&&8&8}':s=a*(ord(c)-32)+s;a^=9
print s


Try it online!

Same principal as my answer over here