Вывести сообщение Аресибо

38

Сообщение Аресибо - это межзвездное радиосообщение 1974 года, несущее основную информацию о человечестве и Земле, отправленное в шаровое звездное скопление M13 в надежде, что внеземной разум сможет его получить и расшифровать ... Сообщение состояло из 1679 двоичных цифр, приблизительно 210 байтов ...

Число 1679 было выбрано потому, что оно является полупростым (произведение двух простых чисел) и должно быть расположено в виде прямоугольника 73 рядами по 23 столбцами. Альтернативное расположение, 23 строки на 73 столбца, создает непонятный набор символов (как и все другие форматы X / Y).

Сообщение Аресибо

Это сообщение с добавленным цветом, чтобы выделить его отдельные части. Фактическая двоичная передача не несла информацию о цвете.

Источник: Википедия


Ваша задача - вывести сообщение Аресибо в точном формате 23х73, как показано на рисунке. Любой из этих форматов вывода приемлем:

  • Текст, используя один символ для единиц, а другой для нулей (используя обычные правила для разделения строк)
  • 2D массив двух разных значений
  • Изображение 23x73 с двумя разными цветами
  • Непрерывный поток из 1679 элементов двух разных значений (т. Е. Любого из вышеперечисленных форматов, но плоский).
  • 1679-битное целое число. Укажите порядок следования битов и байтов (порядковый номер) в вашем решении.

Для вашего удобства вот копируемая версия (также пример вывода в текстовом формате):

00000010101010000000000
00101000001010000000100
10001000100010010110010
10101010101010100100100
00000000000000000000000
00000000000011000000000
00000000001101000000000
00000000001101000000000
00000000010101000000000
00000000011111000000000
00000000000000000000000
11000011100011000011000
10000000000000110010000
11010001100011000011010
11111011111011111011111
00000000000000000000000
00010000000000000000010
00000000000000000000000
00001000000000000000001
11111000000000000011111
00000000000000000000000
11000011000011100011000
10000000100000000010000
11010000110001110011010
11111011111011111011111
00000000000000000000000
00010000001100000000010
00000000001100000000000
00001000001100000000001
11111000001100000011111
00000000001100000000000
00100000000100000000100
00010000001100000001000
00001100001100000010000
00000011000100001100000
00000000001100110000000
00000011000100001100000
00001100001100000010000
00010000001000000001000
00100000001100000000100
01000000001100000000100
01000000000100000001000
00100000001000000010000
00010000000000001100000
00001100000000110000000
00100011101011000000000
00100000001000000000000
00100000111110000000000
00100001011101001011011
00000010011100100111111
10111000011100000110111
00000000010100000111011
00100000010100000111111
00100000010100000110000
00100000110110000000000
00000000000000000000000
00111000001000000000000
00111010100010101010101
00111000000000101010100
00000000000000101000000
00000000111110000000000
00000011111111100000000
00001110000000111000000
00011000000000001100000
00110100000000010110000
01100110000000110011000
01000101000001010001000
01000100100010010001000
00000100010100010000000
00000100001000010000000
00000100000000010000000
00000001001010000000000
01111001111101001111000

Если по какой-то причине ваш язык имеет встроенную функцию для сообщения Аресибо, вы не можете использовать эту встроенную функцию.

Удачи!

ОБНОВЛЕНИЕ: Я принял ответ 05AB1E, так как он был первым, который был короче исходного сообщения. Не позволяйте этому отговорить вас от новых решений.

ОБНОВЛЕНИЕ 2019-09-09: Принятый ответ перемещен в новый ответ 05AB1E, так как он отменяет предыдущий ответ 05AB1E. То же самое относится и к предыдущему обновлению; новые решения по-прежнему приветствуются.

Beefster
источник
9
Если в языке есть встроенное сообщение для Аресибо, я могу со всей уверенностью сказать, что я видел все в этом мире c:
Луис Фелипе Де Иисус Муньос
6
Mathematica (IIRC) имеет встроенный образ для Лены, поэтому меня не удивит, если у нее также будет сообщение Aricebo.
Beefster
@RobertS. нет, потому что есть другие допустимые форматы, кроме текста.
Beefster
4
In the spirit of the original format, a flat result/output should be allowed. The whole point of 1679 bits is exactly that the proper number of rows and columns can be inferred from the signal length.
Adám
4
@LuisfelipeDejesusMunoz Mathematica has a builtin to determine goats in a picture, so an Arecibo message builtin wouldn't really surprise me either.. That language is built on builtins of the universe.. >.>
Kevin Cruijssen

Ответы:

2

05AB1E, 182 bytes

•sv¯ö¨₁ÿ.ÛïžôΔ¨γ_Ígv…=Bм„Ð.(ܦi´…ε±G½0^/₃öRÛž¼¤"āêL!ˆ6‘Gā܇ðв₁÷Ã7€₂䬂Cć¨g¾†@÷[_-68¯a∍iG*6ÆîÆ;>éjζãÎÂ+ºžnî¼ć'(ÝÞΔ‹∞ÉݹÕ5λ₆*a|§oÄmôæ¨;—:hž¥ð¢ocË'¨%¡4Ćáß©ìća;FÁ?iˆèεƒʒ•Ž6–FD4‰`3ÊD?i-

Try it online! (uses 1 for 0 and 0 for 1, as allowed by the question).

Try it online! (5 bytes longer, 0 for 0 and 1 for 1, added newlines for readability).

Most of the code is a base-255 integer constant N, the rest is an Asymmetric Numeral System decoder, using hardcoded probabilities of 75% / 25% (the actual frequency of 0 is 76.35%, which is so close to 75% that it would only save 1.2 bits in the payload, while the nice and round 75% lets us save several bytes in the decoder).

Ž6–F                  # repeat the following 1679 times:
    D                 #  duplicate N
     4‰`              #  divmod 4: pushes N / 4, N % 4 on the stack
        3Ê            #  is N % 4 != 3 ? (boolean 1 or 0)
          D?          #  print a copy
            i-        #  if it's 1, subtract: N = N - (N / 4)
                      #  (otherwise, N = N / 4, since that's the top of the stack)

Here's the ANS encoder that generated the constant: Try it online!

Î                          # start from N = 0
 Rv         ]              # for each bit in the reversed input:
   4*                      #  N *= 4
     yi                    #  if the bit is 1:
       3+                  #   N += 3
         ë                 #  else:
          3÷               #   N /= 3 (integer division)
             ₅B'•.ø        # compress N as base-255
Grimmy
источник
Good work at obsoleting the previous 05AB1E answer!
Beefster
13

05AB1E, 215 210 200 bytes

Saved 15 bytes thanks to Magic Octopus Urn

•cOž¤4é57ñΛ\Ö₃BαöĀíL½₅üBdoÙRθLγ¨G×Tćú$G(˜ƒ¦!€R»SDrµCnJ†d∊ζ·<8‡T@|‹ï=BζćósxG\ÙÎ$¿o₁5/ÔŸÇBûXé-”a::Ž]°∊y;ζ]MÜβ‘иL”β{üÃÇíäc€÷›ÎU=}¨иaŸdY`»¾ÚUβ:ô©¦β†₅DGŠβ3Jêθ,äá!ícqšVÖ›lÈΣ¯pε €êʃDpÙ/¬Žλ8:ãÿ3=€.Þć•3BY¾4×:

Try it online! or with Additional formatting

Base-255 encoded trinary string with occurrences of 0000 replaced by 2.

Emigna
источник
@MagicOctopusUrn: Thanks! That makes it 210 even :)
Emigna
It's actually even better if you replace 0000 with 2 by 9 more bytes. - pastebin.com/aZ6tHxjx for 201
Magic Octopus Urn
@MagicOctopusUrn: Yes, I found that as well and was just about to post it :)
Emigna
2
Cool! Since the Arecibo messages is 210 bytes (23 * 73 / 8 = 209.875), your solution (currently at 200 bytes) is shorter than the message itself!
J-L
I went ahead and made this the accepted answer since it was the first one to be shorter than the message itself.
Beefster
11

Java, 688 678 590 379 361 bytes

Returns a string.

n->new java.math.BigInteger("in95mzupnpa2r0khpoepyql6ioqyn413avucdtfay6indx4wh9dehe3sn18klobtf4z9g9q17umqmwpegr2khb5eqinn7azl4jpfp2a8eui0xfrx5qwrou6gd65jh4ge3ls14k5lu7qrvmg6942ms29u5rb8fa6yrdhfoh5zoi9bdi7uh5ig0u0ff9kounth8sh357x7qox4m3oqviqsbrvakonbka4ahp21bgzi5v1akzzuqoncszhpabbru9q1uo2g11zr73iuyiqr5ikr69zn7cdv7e1lhd6ese9",36).toString(3).replace("2","0000")

-10 bytes by returning the raw stream (old answer)
-88 bytes by using base 10 numerics (thanks @ceilingcat!)
-211 bytes (I knew it could be golfed!) by using a base-36 encoded BigInteger (thanks @JollyJoker!)
-18 bytes by using a different encoded integer (thanks again @JollyJoker)

Try it online!

Explanation:

n->new java.math.BigInteger("base36 string",36) // Decode the base-36 integer.
   .toString(3)                                 // Re-encode as ternary
   .replace("2","0000")                         // Replace 2 with "0000"
                                                // Implicit return
Benjamin Urquhart
источник
1
Comments are not for extended discussion; this conversation has been moved to chat.
Adam Lear
9

Jelly, 213 bytes

“H²ɓ¶Ṡḷ€ẹ]ƒf*ḳḢ&ƁṇOḥ{ḄṫwỊ+oLạʋߢH9¢¹÷ỴɗÇ⁶ƲƙæḊẋ3³=1!VƇƁ'D⁺3Ỵɱ©⁵%fȯez#ƈjƒżṆo.ZF⁶ċṢ⁶ọṛb9Ȯƒd?ƁUĠt4ẇ,ḞġƒµƭfʠƁP§÷øȤŻPɲẋ(¢ß¢(⁽3¶ṙėɗy@ṁYȮL~e⁷ƤĊ§nỊṅµṠ°@7ẠB>Ġ⁻İ}uy¡½:esOpḢt}qS©HÞṬĖṛṇḣ9÷;ESḢ,Ẉ^ṙpƲ©tṃwçnẒṆ¡⁻Jıƒị£-&Ɱ*ẋʂżoȯÑḢɼ’

Try it online!

I played around with Huffman coding, but the improvements in data size were outweighed by the extra code. As such, this is simply a base-250 encoded version of the desired output. Output consists of an integer that when decoded as bijective base 2 will yield the 1D list of 1s and 2s. Thanks @Emigna for pointing out the change in rules.

Try it online - with further decoding to demonstrate output!

If a more conventional binary encoding is preferred, here is one that encodes an integer representation of the inverted binary message. The most significant bit of the integer represents the beginning of the message.

Nick Kennedy
источник
7

Brainfuck, 2360 2008 1938 bytes

-[>+<-----]>---......+.-.+.-.+.-.+.-............+.-.+.-.....+.-.+.-.......+.-.<++++[->.+.-..<]>+.-.+..-.<+++++++++[->.+.-<]>..+.-..+.-<++++++[->......<]>.+.<++[->.-...................+..-.+<]>.-..................+.-.+.-.+.-..................+.....-<++++++++[->....<]>+..-....+...-...+..-....+..-...+.-.............+..-..+.-....+..-.+.-...+..-...+..-....+..-.+<++++[->.-.+....<]>.-<+++++[->.....<]>.+.-.................+.-............................+.-.................+......-.............+.....-.......................+..-....+..-....+...-...+..-...+.-.......+.-.........+.-....+..-.+.-....+..-...+...-..+..-.+.-.+.....-.+.....-.+.....-.+.....-..........................+.-......+..-.........+.-...........+..-...............+.-.....+..-..........+......-.....+..-......+.....-..........+..-.....<+++[->........+.-<]>.....+.-......+..-.......+.-.......+..-....+..-......+.-..........+..-...+.-....+..-...............+..-..+..-.............+..-...+.-....+..-.........+..-....+..-......+.-.......+.-......+.-........+.-.....+.-<++[->.......+..-........+.-...+.-.<]>........+.-.......+.-<++++[->.....+.-..<]>..........+..-.........+..-........+..-.........+.-...+...-.+.-.+..-...........+.-.......+.-..............+.-.....+.....-............+.-....+.-.+...-.+.-..+.-.+..-.+..-......+.-..+...-..+.-..+.......-.+...-....+...-.....+..-.+...-.........+.-.+.-.....+...-.+..-..+.-......+.-.+.-.....+......-..+.-......+.-.+.-.....+..-......+.-.....+..-.+..-<+++++++[->.....<]>+...-.....+.-..............+...-.+.-.+.-..<++++++[->.+.-<]>..+...-.........+.-.+.-.+.-.+.-................+.-.+.-..............+.....-................+.........-............+...-.......+...-.<++[->........+..-...<]>....+..-.+.-.........+.-.+..-<++[->.....+..-..+..-..<]>..+.-...+.-.+.-.....+.-.+.-...+.-..<+++[->..+.-...+.-<]>........+.-...+.-.+.-...+.-............+.-....+.-.<++[->...+.-.........<]>+.-..............+.-..+.-.+.-...........+....-..+.....-.+.-..+....-...

Try it online!

I will probably golf this even further soon.

orthoplex
источник
5

Deadfish~, 1115 1088 1084 bytes

oooooo{i}ooo{d}iod{o}{i}c{d}ooiodoiodoooooiodoiodoooooooiodoo{i}c{ii}is{iiii}doooio{{{d}}}oioodooiodo{i}coooooooo{d}o{{i}}oo{{d}i}c{d}{oo}ooo{i}c{d}{o}ooioodooooooooo{i}c{d}{o}ioodoiodooooooooo{i}c{d}{o}ioodoiodooooooooo{i}c{d}oooooooooiodoiodoiodooooooooo{i}c{d}oooooooooiooooodooooooooo{i}c{d}{oo}ooo{i}c{d}ioodooooiooodoooioodooooioodooo{i}c{d}iod{o}oooioodooiodoooo{i}c{d}ioodoiodoooioodoooioodooooioodoiodo{i}c{d}iooooodoiooooodoiooooodoioooood{i}c{d}{oo}ooo{i}c{d}oooiod{o}oooooooiodo{i}c{d}{oo}ooo{i}c{d}ooooiod{o}oooooooiod{i}c{d}ioooood{o}oooioooood{i}c{d}{oo}ooo{i}c{d}ioodooooioodooooiooodoooioodooo{i}c{d}iodoooooooiodoooooooooiodoooo{i}c{d}ioodoiodooooioodoooiooodooioodoiodo{i}c{d}iooooodoiooooodoiooooodoioooood{i}c{d}{oo}ooo{i}c{d}oooiodooooooioodoooooooooiodo{i}c{d}{o}iood{o}o{i}c{d}ooooiodoooooiood{o}iod{i}c{d}iooooodoooooioodooooooioooood{i}c{d}{o}iood{o}o{i}c{d}ooiodooooooooiodooooooooiodoo{i}c{d}oooiodooooooioodoooooooiodooo{i}c{d}ooooioodooooioodooooooiodoooo{i}c{d}ooooooioodoooiodooooioodooooo{i}c{d}{o}ioodooioodooooooo{i}c{d}ooooooioodoooiodooooioodooooo

Try it online!

If someone has the patience to golf this further, I salute you ahead of time. :P

-27 bytes by printing 10s and 100s in places where applicable.
-4 bytes by printing three 1000s and one 1001 on line 3

Reinstate Monica
источник
4

Piet, 1763 codels

Outputs a stream of 0s and 1s (no line breaks).

Codel size 1:

Arecibo message program with codel size 1

Codel size 4, for easier viewing:

Arecibo message program with codel size 4

Explanation

  • First, push a sentinel value of -1 onto the stack.
  • Then push the Arecibo message, in reverse order (because it's a stack), using run-length encoding.
  • Finally, alternate between two loops, one printing zeroes and the other printing ones.
    • The loop counter is the current stack value, decremented until it hits zero, at which point it is discarded and we switch to the other loop.
    • Between the zeroes-loop and the ones-loop, check for the sentinel value, exiting if it is found.

Notes

The program follows a spiral path, clockwise from top left into the centre. The scattered black blocks that roughly follow the diagonals are the flow control. Here's the trace from NPiet.

I've been working on this since the day this challenge went up, but it took a little bit of time to get the message "written" into the picture! I wrote the final loops and the sentinel value first, and then built up the message from the centre outwards. (Since Piet always starts execution from the top left, I expected to have to shuffle and rotate the image around to avoid excess whitespace, but it fit perfectly!)

Fun fact: Run-length encoding in Piet doesn't (by itself) save any space. It takes n codels of one colour to push the value n onto the stack, or n codels of different colours to push that many 1s onto the stack. So it's the same number of codels either way. But the bigger numbers that RLE gives you mean you can use arithmetic tricks (e.g. instead of pushing 9, you can push 3, duplicate, and multiply) to reduce the number of codels, and funny-shaped blocks to fill in available whitespace.

I wasn't sure about how to count score for Piet entries. I found some that seem to count all codels, and others that explicitly only count those actively used. I just counted them all; ignoring white codels (even those that the program never moves through) seems akin to ignoring whitespace in a more typical programming language.

Oh, and I've just now (two hours after posting) realised that I wasted the last bit of time working on this. I wanted to trim off the almost-completely-white last row and column, so I shuffled things around... including the black flow-control blocks. But the edges of the image work the same as black! If I'd just remembered that, I wouldn't have needed to spend so much time puzzling over the intricacies of DPs and CCs...

Tim Pederick
источник
3

C# (Visual C# Interactive Compiler), 366 332 329 319 bytes

int i;foreach(var g in"*ЀʂЄ࢈ҲપԤ␀␀␀؀ȀȀȀ؀␀␀సؘࠀƐഘؚ྾ߟ␀␀Ā␀␀ྀ␀␀రܘࠈഌΚ྾ߟ␀␀ă␀ྃ␀ȁăÃ1`ƀ1`ÃĂȃЃЁȂĀ`ÀƀȺ؀Ȃ␀ȏЀȗɛ'Ŀஇ7;ȅ?ȅ0ȍЀ␀␀΂␀ΨՕ΀Ŕ␀ŀЀ?܀àǀƀ`̀°٠Ƙѐʈш҈EB@Ѐޟɸ")Write(Convert.ToString(g,2).PadLeft(12-i++%2,'0'));

Replace all instances of with \0 to test.

Try it online!

C# (Visual C# Interactive Compiler), 305 bytes, 210 chars

_=>"*ЀʂЄ࢈ҲપԤ␀␀␀؀ȀȀȀ؀␀␀సؘࠀƐഘؚ྾ߟ␀␀Ā␀␀ྀ␀␀రܘࠈഌΚ྾ߟ␀␀ă␀ྃ␀ȁăÃ1`ƀ1`ÃĂȃЃЁȂĀ`ÀƀȺ؀Ȃ␀ȏЀȗɛ'Ŀஇ7;ȅ?ȅ0ȍЀ␀␀΂␀ΨՕ΀Ŕ␀ŀЀ?܀àǀƀ`̀°٠Ƙѐʈш҈EB@Ѐޟɸ".Select((g,i)=>Convert.ToString(g,2).PadLeft(12-i%2,'0'))

Same with above, replace with with \0 to test. Output as IEnumerable<string>.

Try it online!(Courtesy of Jo King)

Embodiment of Ignorance
источник
I believe the ++ in 12-i++%2 is a nop (at least, it worked for me when I removed it)
my pronoun is monicareinstate
@someone They are a copy-paste from the old answer I forgot to remove
Embodiment of Ignorance
2

Perl 6, 368 bytes

.say for :36('FJXOE0PDDNF5Y5EHGB8M9SWMXQOXIKIT9F6ZKWWDEACHCBGXL1N2H60CN0CJ4EMKF7D6MODSKYJVNR4SFTDR6NSM421LQ67B6MWF0G5BQATFOJJJBQ0UFQM64T0MWSQN41C4S5D1QR5KJM2L9UTYMMKUBBQWY45YCMRGO8ZRGTQH7LXMZBUASLCTKX30IH0AYKYEPHO8HFHX8GAY5WM38YOSUX0HABYSH2PPBLRDRZIN5ANAQ3V8PLOZ6EHC0UI95EVJVYD1820T6J14HGX85NWFQET2NWOMSNUT0JW4LHMY90X094TEE9KXJXSNN6YPERFQW').base(2).substr(1).comb(23)

Try it online!

The long string is the message as a single base-36 number (with a single prefixed 1 bit to preserve the leading zeroes) which is then converted back to binary and printed 23 bits at a time.

Sean
источник
You can use >>.say and &{S/.//} to save bytes. Have you thought about using a different base instead?
Jo King
Yes, I tried using base 65536/Unicode, but the message runs into some forbidden surrogate codepoints. I was able to avoid that by adding a fixed offset to each codepoint, but astonishingly, some of the generated strings crashed Emacs a few times. Resolving the issues started taking more time than I could afford to commit. I'll probably revisit the problem later.
Sean
There's no point going into multiple byte characters, since that increases your byte count. 289 bytes by implementing my tips from above and using base 122 (to avoid carriage returns)
Jo King
2

Wolfram Language (Mathematica), 383 bytes

StringPartition[Uncompress@"1:eJylVNsRwjAM44s92KBaBTZgAUZhZXqtHUuOWrgjfSRRHFlO4tyer/vjfb1clq0gHirZLRjby986hppcT5p+L3BmgJ3t4Ul4GsNyG++7YbaXLh0ZTPhXa4Sn+X/s9Qfk3Hx2cOaSIuNYaVu5laschvgzSqAjHeZBhilKgKBDEhw0upJRg+HOK4MyNC29sfbc3RV0VPDqeLiRTsG1ulExq1IitpunOa7asnYM9siDZ6eidUCkEzBOUbCkGIig4aTyUGBYWAX6W6aXIWGGI/HlhmsqzSU0QTZjkMVpaX5sBsm1OGKVg1qdjKP0EdyqZBRLhukn8DLBQav6kccgz8OKfgBzjj6Z",23]

Try it online!

J42161217
источник
2

Node.js, 333 bytes

Returns a binary string of 1,679 characters.

_=>Buffer(")SI)=.);1K?>>>2333A3,93/I3>3)g33)AEAAI)5JQZJTddda3)*3*33+3,e)*e3)//0/1+)1C/7Cgggg3395)9)A3IY)h*IH),39+)995*)AA-)59Y)*O3Z,)//*)91**)A*-)Y+1)I11+)I1)/)5)Y*0?)+)I)-0Y)1@;_*7<gaE/a)Q7[*9HM+IY16I33)a1)*^.><I+S3.38I)*hY)7)a)Y)A,9*A5Y/A:9=9K:1I-=9)19I)9*329)GH<").map(x=>s+=(x-51&&x-41).toString(2).padStart(x-51?6:12,0),s='')&&s

Try it online! (with formatted output)


JavaScript (ES8), 413 bytes

Returns a binary string of 1,679 characters.

_=>atob('AsKoAFBQEiIlwpVVUk!!ABwo!DQ!Gg!V!Aw7g!!GHGHCi!yGjHChsK+w7vDr8K!!Q!Q!!g!/DgAHDs!AGGHDhiAgCGhjwprDu8Ovwr4!ABAw4AQAcK!MKDAD8GB8OAD!QCAQQMBAYYEAMQwABwpgAMQwBwoYEBAgEEBgEQDAIwoAgIMKAwoDCgMKABgDDgDAEdcKACAgAEHwAIXTCtgTDpMO+w6HDgcK4AsKDwrIFB8OkCgwINg!!A4IAB1FVTDoArCo!U!/CgAB/w4ADwoDDoAwAYDQBYMOMBmEUFEIkSMKARR!woQgAQB!MKUAHnDtA'.split`!`.join`AA`).replace(/[\s\S]/g,c=>c.charCodeAt().toString(2).padStart(8,0))

Try it online! (with formatted output)

Arnauld
источник
2

Bubblegum, 275 236 bytes

00000000: e006 8e00 e45d 0018 6988 6507 a228 f86f  .....]..i.e..(.o
00000010: f042 c62f d4d7 b99e 38bc 56c4 52e8 2630  .B./....8.V.R.&0
00000020: 8aaa 7252 d47d 5ef4 c96a 511f 6842 423f  ..rR.}^..jQ.hBB?
00000030: 4532 ca9f 22d3 1633 e0c4 665a d5dc 4e68  E2.."..3..fZ..Nh
00000040: 7b09 76ae 3c7e f9d4 fa4a 05e0 4163 c580  {.v.<~...J..Ac..
00000050: c585 a383 2396 4ca9 1f48 a4b9 744e 37c8  ....#.L..H..tN7.
00000060: 68c5 af23 645d 59a7 542a e6d1 23b9 3aba  h..#d]Y.T*..#.:.
00000070: f0e6 2738 dfd5 b0a3 c6a3 60bf c5b6 5ae6  ..'8......`...Z.
00000080: 7893 30a8 ae04 edf9 298b b777 4d56 285b  x.0.....)..wMV([
00000090: cb74 07cc 7a7b a399 3dc7 c6e7 b693 e715  .t..z{..=.......
000000a0: d908 876e 001f 7408 3c6a 5fcd 37cb 02c4  ...n..t.<j_.7...
000000b0: 93de 33c2 a11e 5bac cd12 d99a fac3 e0fa  ..3...[.........
000000c0: 5268 94f7 d640 0f73 cede f79d 821f 39d1  Rh...@.s......9.
000000d0: dc49 ff06 6962 6c31 dc29 a077 01c3 7690  .I..ibl1.).w..v.
000000e0: 85ef bbec 31d7 5c7f f9fc 8c00            ....1.\.....

Try it online!

orthoplex
источник
2

bash + GNU tools, 351 bytes

base64 -d<<<H4sIAPnNrVwCA6WUCRLDIAwDv8T+/3NNG4wvkTBTcisGSyA8xrcxj9Ds02F+Z7yuf3hnPyz0vYEGz+FG3IKBs+x3oL2PSh0TM/PnaGamft9nPUCew3uCp5RBWdRKGz+qNJn8qRKkkNaTBgeVIFXWOdi8VCaIeUnsfHo6TXpaFa3H5olf6J5MuIHLoEi0uKcRFCvEXG4xseglKzZg7kpYJSLMA3M7wXKR+/L2WiK0kvg+TDASLp6Co1KEVIlVmFzhCktRhBBDdSZYU1xKHrmDUllcWpNR/YNW2QNcHtF0rSySb0MXk/SDUgEwG5gfLvQDxuEdDo8GAAA=|gunzip

TIO

Nahuel Fouilleul
источник
didn't see your bash post before I posted mine - so much smaller!
Noodle9
2

MathGolf, 223 220 bytes

'06*"x·<×J× Ç×►B×ê\"@$↕!◙è0♥f░×→0×♠p└☺α?×└•×◙×P♣p¬è:×►∟××××←♦♠♣≥â☻┘A☺▄αp⌂r☻[║►×>◘×♦♦└:☻↑`×♥@@@@►►@♦↑ ☻♀◘☻♦☻☻├×å↑×╠×Ç!♠ 0♀◘↑◘☻♦◘×♠α♥â▼ÇA×└×◘` ×××▀≈}═14♦►►π0♀××°×α•×►×××☻×◘××└≈}_├↑♪↓×─0♫♥×××|××*××♪×Ç♠×└×××× ⌐¬╩↕◄○((×T☺"$à+

Try it online!

Explanation

'0                push single character "0"
  6*              repeat 6 times
    "..."         push the magic string
         $        convert to ordinal
          à       convert to binary string
           +      pop a, b : push(a+b) (add the 6 zeroes)
                  below is the footer
            L/    divide into groups of 23 characters
              n   join array with newlines into string
maxb
источник
You can move the L/n to the footer, so it's actually 220 bytes. Can more bytes be saved by porting the 05AB1E / Java answers (using this compressed integer, convert it to base-3, and replace all 2s with 0000s)?
Kevin Cruijssen
@KevinCruijssen nice catch! I wish I had more string replacement functions, but that's not part of MathGolf right now.
maxb
How about a map per digit, which maps 2 to ♫░╞? EDIT: Never mind. I see you don't have a Base Conversion builtin (except for binary/hexadecimal) to convert to base-3?
Kevin Cruijssen
@KevinCruijssen I have thought a bit on how I should change the base conversion. I certainly don't need one command for converting binary string to decimal, and another for converting a binary array to decimal. That way, I can fit another base conversion command in (and the idea has always been to have general base conversion in the language).
maxb
Surely you can move the + to the footer as well
Jo King
1

Perl 5, 460 bytes

printf"%023b",oct"0x$_"for qw/15400 141404 4444b2 555524 0 600 1a00 1a00 2a00 3e00 0 61c618 400190 68c61a 7df7df 0 80002 0 40001 7c001f 0 618718 404010 68639a 7df7df 0 81802 1800 41801 7c181f 1800 100804 81808 61810 18860 1980 18860 61810 81008 101804 201804 200808 101010 80060 60180 11d600 101000 107c00 10ba5b 1393f 5c3837 283b 10283f 102830 106c00 0 1c1000 1d4555 1c0154 140 7c00 1ff00 701c0 c0060 1a00b0 330198 228288 224488 22880 21080 20080 9400 3cfa78/

Try it online!

Xcali
источник
1

Python 2, 336 bytes

print bin(int('gVQAKCgJERLKqqkgAAAAAMAABoAADQAAKgAAfAAAAAMOMMQAGQ0Yw19998AAAAgAAgAAABAAB+AA+AAADDDjEBAENDHNffffAAAAIGAIAMAAQYAfgwPgBgAIBAIIGAgMMCAGIYAAzAAYhgDDAgIEAggMAiAYBEAQEEBAQEADAGAYAjrABAQACD4AELpbAnJ/cODcAUHZAoPyBQYEGwAAAAAcEAA6iqpwBVAACgAHwAA/4AHAcAYAMBoAsGYDMIoKIRIkQCKIAEIQAIAgAEoAPPp4'.decode('base64').encode('hex'),16))[3:]

Try it online!

Prints a string of bytes

TFeld
источник
1

Java (OpenJDK 8), 364 bytes

n->new java.math.BigInteger("in95mzupnpa2r0khpoepyql6ioqyn413avucdtfay6indx4wh9dehe3sn18klobtf4z9g9q17umqmwpegr2khb5eqinn7azl4jpfp2a8eui0xfrx5qwrou6gd65jh4ge3ls14k5lu7qrvmg6942ms29u5rb8fa6yrdhfoh5zoi9bdi7uh5ig0u0ff9kounth8sh357x7qox4m3oqviqsbrvakonbka4ahp21bgzi5v1akzzuqoncszhpabbru9q1uo2g11zr73iuyiqr5ikr69zn7cdv7e1lhd6ese9",36).toString(3).replaceAll("2","0000")

Try it online!

Explanation: First had n->new java.math.BigInteger(str,36).toString(2), just converting a radix 36 number to binary, but that needed nine extra chars for leading zeroes. Then, I got the idea of run-length encoding some zeroes as twos. A length of four zeroes seems to minimize the radix 36 length, so n->new java.math.BigInteger(str,36).toString(3).replaceAll("2","0000")

See the discussion under this answer for the leading zeroes bug fix by @KevinCruijssen

JollyJoker
источник
Nice. It's impressively short for Java!
Eric Duminil
1

[Python 2], 345 bytes

s=''
for c in")pG/K(K*j$h%kk$ppjGE&I6S6S5[5eCv~vw0x&z$wgqcde$e=G4G?G4eG0e:vv~w*G,gn$wy$uuuuG=G)I,G.I2G(I-eG(I)e-I0G+G+G(G)I*G*vI)G-w'I2y0w'I,vI)G*G)G+G(G*I+W+I+W,G*G(G*G*G*G/I,I+I,iq.G*G1G(e/g$c%sG)m%md~$M(},K(cO)K(eO)K(I)G(aE$M(G1c$hpoI,pG3K1e3eU/M*M,I.I*S,Q(y*y'hG(ng&j$j$G+hW/g'G/G,G1k.d$e$mN":c=ord(c)-35;s+=[bin(c-35)[2:],'0'*c][c<35]
print s

I encoded the length of strings of 0s as a byte starting at chr(31). Then I encoded the remaining 10101 as binary numbers starting at chr(70) up to chr(126). Binary strings that didn't fit were split up into smaller chunks.

Edit: Reduced to 326 bytes. Thanks Jo King

Edit: Fixed a bug in the code generator program

Edit: Final Edit

SurpriseDog
источник
You don't need to save the big string in o to a variable.
xnor
1

Zsh, 577 bytes

try it online!!

S=fxxxxibxxdxxfyzzzyx1yxxxxxxxxyyywl2ij1xxhj1xxhixxxhi5iw2d3c2d2cxl2bxc2az2c2d2ax4x4x4x5wcxpxwdxp15m5w2d2d3c2cxfxhxc1xxc2c2y1xx4x4x4x5wc1f2ixj2kd1e2j15e2f5j2kb1h1hyc1f2gzd2d2fzaf2c1d2ej2b2gf2c1d2ed2d2f1dc1f1hzb1g2hya1h2hya1i1gzb1g1g1dc1l2ed2h2gbz2xx2ibzd1lbzb5jb1dx2xyx1x2fy2yy6x3d3e2a3ixxd2x2b1fxxd6b1fxxd2db1e2a2jwb3e1lb2xxzxxxxx1b3ixxxynxxeh5jf9hd3g3fc2k2eb2a1ix2da2b2g2b2cazxxdxzzazyzyzzezxz1ge1d1d1ge1i1ggyxxia3y4xy3z
for X in ${(s::)S};{case $X in
[a-w])V=$[##$X-96];printf 0%.s {1..$V};;[1-9])V=$[##$X-48];printf 1%.s {1..$V};;[x-z])V=$[##$X-119];printf $[10**$V];;esac}

Used custom encoding logic. The string S is 421 characters, could possibly be compressed a bit more. Letters a-w represent repeated 0s. Numbers 1-9 represent repeated 1s. Letters x y z represent 10 100 1000 respectively.

Maybe I should have tried byte-pair encoding or Ascii85.

roblogic
источник
0

Bash, 702 697 bytes

xxd -r -p<<X|xz -dc
fd377a585a000004e6d6b4460200210116000000742fe5a3e006d7010c5d
0018698865079cf6752c9e9a501a87a798b4844f9fcfdaaf87733b9d8239
48c816d860a938767f6cb81299f3e8a638effe3068c0e096a8949c81d706
7dff3ec44e5df185b3a48e5b5857724386e8c37cfbd5c856b12614ee78ec
c41df4db3aea71fd3a8fa474905609f78eb3fd66e246557965e4ab6dfd67
efbd9202f542ded9cf98a6401ee2d23afb2f544bd2442c6f428fd612397c
f2c6ec50847ddccc5832185e487712e5a7676b97058d7e485d5a3536166a
44ab3c689c93073cdda73b5306a83c4cd268e79db238bfa2d08ac912a578
75020bc7828342d5a62ce367aff7fd89290336128d119fa4272da2b2a79f
5973c71935af054f2d91c1bd3ea4847a3502d6dc8c975114dacf8a4de600
622d80986dbb0cd00001a802d80d00001b16e2a7b1c467fb020000000004
595a
X

Try it online!

Noodle9
источник
0

Ruby, 362 bytes

puts"5r0afnfm8wyke8tfy1pwt7xnuaxyh3wodfp7bhsdufyw0xbdp1pumrz2xir652tuc0ss9oec8yad9vefivd66j126wybhefgk2lv38uqqiur11u26q275jk3h2ucithd59awpaenqpqi1pszh52179zw0ddqtbrvo6kyrrgv8c34pqrp83j8estjp63v29t4hqp9yg2hhzjlq1e9zqx6gh20n9lsttimz3nbq060ritrphxaru7quwmv3oujhd9xjddpbacq4bnpf270znhgto59yn0980itylf95pxw9x7rvkvi7mfql1sx46puo8rg4dq0".to_i(36).to_s(2).rjust(1679,?0)

Integer written in base 36. There's surely a more efficient way to compress the integer, e.g. with zlib or base64.

Try it online!

Eric Duminil
источник
350 bytes if you: (1) use "%b" for formatting instead of to_s, (2) prepend ?0*6 instead of calling rjust
G B
0

[C++ (VC++)(but tested with gcc as well)], 585 bytes

#define l(x,y)for(int x=0;x<y;x++)
void f(){const char*a="02A800505012Y595Y240U180YD0Y1A0Y540YF80V61C618800321A3186BEFBEF80X10Y40W20YFC001F0X1861C620200868639AFBEFBE0W40C0100180Z83003F0607C00C001008041030101860400C430Z19800310C018604040804101804403008802020808080800600C030047580080800107C002174B604E4FEE1C1B80283B20507E40A0C08360U3820Z751554E00AA0Z140ZF80Z7FC00380E00C0060340160CC06611414422448804510Z8420010040Z940079F4F0";int x=1679;l(i,365){int d=a[i],c=0;d-=(d>47&d<58)?48:((d>64&d<71)?55:0);if(d>70&d<91)c=91-d,d=a[i-1];for(c;c>=0;c--)l(j,4){if(x--)cout<<(int)((d&(8>>j))>0);}}}

Try it online!

ungolfed Version (lacks the break after the 1679th element though and goes until the 1680th):

#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
    const char arecibo[]="02A800505012Y595Y240U180YD0Y1A0Y540YF80V61C618800321A3186BEFBEF80X10Y40W20YFC001F0X1861C620200868639AFBEFBE0W40C0100180Z83003F0607C00C001008041030101860400C430Z19800310C018604040804101804403008802020808080800600C030047580080800107C002174B604E4FEE1C1B80283B20507E40A0C08360U3820Z751554E00AA0Z140ZF80Z7FC00380E00C0060340160CC06611414422448804510Z8420010040Z940079F4F0";
    int i = 0,j;
    while (i<sizeof(arecibo)-1)
    {   
        char digit = arecibo[i];
        int count=0;
        if (digit >= '0' & digit <= '9')
        {
            digit -= '0';
        }
        else if (digit>='A'& digit<='F')
        {
            digit -=  'A'-10;
        }
        else if (digit > 'F'&digit<='Z')
        {
            //digit does not contain any valid hex digit in this case
            count = 'Z' - digit+1; //digit = Z means repeat 2 more times...
            digit = arecibo[i - 1];
        }
        for (count; count >= 0; count--)
        {
            for (j = 0; j<4; j++)
            {
                cout << (int)(((digit)&(8 >> j))>0);
            }
        }
        i++;
    }
    return 0;
}

as an Explanation: i concatenated the 73 lines of sample output given to one long line. i encoded them in hexadecimal where the bit order is msbfirst (using this program https://github.com/Marc-Bender/longBinaryStreamToHex/releases/download/addedErrorCode-4/longBinaryStreamToHex.exe) i shortened the Output of that by about 70 hexadecimal Digits by using the letters 'G'-'Z' as a sign to repeat the last Digit for a certain amount of times (Z = 2more times, Y = 3more times …) the rest should be relatively self explainatory for Code-Golfers. abusing the preprocessor to shorten loops, abusing the , Operator and the like.

Output Format is uninterrupted stream of 1679 0/1-values.

der bender
источник
before anybody asks the const is for compatibility with VC++ (what the main development work was done with)
der bender
@ceilingcat i think you can even short that more by pitting your include in the header section...
der bender
554 bytes
ceilingcat
0

Perl 6, 348 bytes

{"000000"~:36<5r0afnfm8wyke8tfy1pwt7xnuaxyh3wodfp7bhsdufyw0xbdp1pumrz2xir652tuc0ss9oec8yad9vefivd66j126wybhefgk2lv38uqqiur11u26q275jk3h2ucithd59awpaenqpqi1pszh52179zw0ddqtbrvo6kyrrgv8c34pqrp83j8estjp63v29t4hqp9yg2hhzjlq1e9zqx6gh20n9lsttimz3nbq060ritrphxaru7quwmv3oujhd9xjddpbacq4bnpf270znhgto59yn0980itylf95pxw9x7rvkvi7mfql1sx46puo8rg4dq0>.base(2)}

Based on Benjamin Urquhart's Java solution.

Uses a straight stream of 0 and 1 characters. The link below has some code to prettify the output.

Try it online!

bb94
источник
0

Tcl, 366 bytes

binary scan [binary decode base64 QBUACgpIRKSpqkoCAAAAgAEAsAAAWAAAKgAAHwAAAGA4hhEATFiMYX3f9wEAAAgAIAAAAAQA8AOADwAAGIZjBAQQFsZZ3/d9AAAAAgMIgAEAwQD8YOADMAAIECAIDAgYBgIwwgCAGQCMMIBhICAQIAgYIAIMEAEEBAEBAQFgAAMMIK4BEBAACD4AhC5tICd/h4MdQMFNoOAnUDAQbAAAAAAcBACuqCoHUAUAKADwAQD+A8ABBzAABiyABjNghigoQiQSAaIIACEEgAACACkAni8P] b* z
puts [join [regexp -all -inline .{23} $z] \n]

Try it online!

wolfhammer
источник
0

C++ (with Gnu multi-precision library), 359 bytes

This outputs the string as one line. It uses '1' for 0, and '0' for 1 :/

It simply reads the embedded string as base 62, and prints it as base 2.

Use g++ -g arecibo.cpp -lgmp -lgmpxx to compile and link

#include<gmpxx.h>
main(){mpz_out_str(stdout,2,class_mpz("vuXXKBYAu1hPsJPbFSf49akyFd0bjJbMIV3upYndU8kYFPsXcpRUK6c9qnzLfORxkxGL7ZfoSwgSxFbCrydjHL603QcxexopAzoYAcAyEiENJJU2vQA2zM8NDbeY6nHgL8rfFoPJaclwxx6TeKeOEknEQHzp7C4la3o8xijBQLOVweFZ1CI9dXy2VQhgnuwF5FeW5mQ909pRMxhn6G3RJ1QEtkS7oGMZYHM03fh4fj391IoYLGVv3iUVuTrV2ghz9CUa9hfGYrdhGoVE2w1inYalYl",62).get_mpz_t());}
CSM
источник
I couldn't get this to work until I replaced class_mpz with mpz_class
ceilingcat
0

Perl 6, 276 bytes

:122[q{3tD!gLF['u#.K>'uCG8cvJZ[on1Z<D!	`Fhqq-_V'"qQn+n0h\:b,vXjo&1TMFaW;wvX;eUS
(ueelNSu,y93\kjGI&?UU/38 :ndi4Y5cyC+ME\g7LWaS;QLjtD^L+aVd(XW%gy\8'Eqk-+f72S5J?(r5!m^5px T[Z'3&jd0lZ'/x%#(}.ords].base(2)~~S/.//.say

Try it online!

Outputs as a series of 1679 0s and 1s. You can have it on different lines by adding .comb(23)>> before the say.

Explanation:

:122["...".ords]                     # Convert the string from base 122
                .base(2)             # To base 2
                        ~~S/.//      # Remove the leading 1
                               .say  # And print

I can probably save bytes by using the output as a 1679 bit integer instead, or reversing the bit representation.

Jo King
источник
0

C++ (gcc), 748 bytes

#define l(X,Y)if(z[i]==#X[0])z.replace(i,1,#Y);
void f(){std::string z = {"ab1eeedala1ebeeheal1mmma1fa1g1eeeeeeea1a1alddhgdbcdgdacedgdacedgdeeedgdndgddhgqiafbcag1dbfa1blceafafbcegcinnnlddhgmddegddhgb1ddelcidbnlddhgqqiafag1hedeblcebcaf1acegcinnnlddhgmhcdegdacdagb1bfda1lcibfhcildacdaga1d1d1almhcheagbqch1blhcmbqgdacachghcmbqgbqch1blmh1d1aga1hfd1aledcd1aledeheaga1heheblmdbqgbcdchga1af1efdga1hedbla1bndala1b1f1ea1fflh1aia1acccl1f1bibff1ldeebf1fla1h1ebfccla1h1ebfbla1bffdalddhgaibedblaieemeeeeelaideeeealdh1ehldcidalhcccidlbihf1hlafdafbgacedefblfachfacagemebeemagema1ma1magbememhgbeb1b1hgbedehghea1edalfcacieacca0"};for(int i=0;i<1751;i++){l(q,cb)l(n,fi)l(m,ae)l(i,c1)l(h,ba)l(g,0l)l(f,0c)l(e,01)l(d,bb)l(c,11)l(b,aa)l(a,00)l(l,\n)printf("%c",z[i]);}}

Try it online!

By replacing the most used substring with a new character until it's not worth it anymore

r3dapple
источник
735 bytes
ceilingcat
0

Python 3, 331 bytes

exit(''.join(bin(i)[3:]for i in b'`UP@JB`IDQKJjjd`@@@@@L@@Ah@@CP@@J`@@_@@@@@LNLLP@FPtXpu}}}|@@@@`@@`@@@A@@A~@@~@@@CCCcDA@DMCGM____@@@@HF@H@L@@PX@_`pO`A`@HA@HHF@`LLB@FHX@@s@@Xa`CC@`HD@``L@b@XAD@PDDA@PD@C@F@X@ck@A@P@BCx@DKi[@gI\x7f\\NC\\@TGY@hOrAPXDFp@@@@@\\D@@zbjipAU@@B`@Gp@@\x7fx@G@\\@X@LAh@lFXCLHhJHQHdPBJH@DHP@H@`@Dh@OOix')[1:])

Try it online!

Jitse
источник