Output the PPCG Prime

69

10

This is the PPCG Prime

624 digits long

777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777111111111111111111111111111111111111111111111111111111111111111111111111111111188888888118888888811188888811188888811188111118818811111881881111881881111881188111118818811111881881111111881111111188888888118888888811881111111881118888188111111118811111111881111111881111881188111111118811111111881111881881111881188111111118811111111188888811188888811111111111111111111111111111111111111111111111111111111111111111111111111111111333333333333333333333333333333333333333



If we split every 39 digits we get

777777777777777777777777777777777777777
777777777777777777777777777777777777777
777777777777777777777777777777777777777
777777777777777777777777777777777777777
111111111111111111111111111111111111111
111111111111111111111111111111111111111
188888888118888888811188888811188888811
188111118818811111881881111881881111881
188111118818811111881881111111881111111
188888888118888888811881111111881118888
188111111118811111111881111111881111881
188111111118811111111881111881881111881
188111111118811111111188888811188888811
111111111111111111111111111111111111111
111111111111111111111111111111111111111
333333333333333333333333333333333333333

Your task is to output the PPCG-Prime

This is .Shortest code in bytes wins.

If you input the PPCG-Prime in the Mathematica function below, you get this result

ArrayPlot@Partition[IntegerDigits@#,39]&   

enter image description here

user72253

Posted 2017-10-22T20:44:46.313

Reputation:

38How on earth did you find this? – Stewie Griffin – 2017-10-23T06:38:55.563

5@StewieGriffin The average probability for a number n to be prime is proportional to 1/log(n), which is not very small, anyway. Just check a lot of numbers until it's prime. – user202729 – 2017-10-23T06:40:34.693

2

Comments are not for extended discussion; this conversation has been moved to chat.

– Dennis – 2017-10-23T12:51:13.160

1@user202729 log(n) is about 1436.6 in this case. – Jeppe Stig Nielsen – 2017-10-24T21:25:21.527

How many primes are <= this number? That would be one way to compress that information, although one that would make the program run incredibly slow. – Fabian Röling – 2017-10-25T13:10:13.367

3@Fabian I don't think this method would be efficient... For a Prime this big (624 digits), the number you are asking has 621 digits (and is even more difficult to golf), Unless this is the 10^621th prime!!! If you want to find your number, here is a simple approximation x/logx by Gauss – None – 2017-10-25T13:31:35.510

Oh, right. Would be interesting to find if its prime index was a prime whose index was a prime whose index was a prime and so on. Hm, that gives me an idea for a different challenge... – Fabian Röling – 2017-10-25T13:50:11.073

Oh, was already done: https://codegolf.stackexchange.com/questions/110812/find-recursively-prime-primes

– Fabian Röling – 2017-10-25T13:52:24.707

Answers

22

Jelly, 55 54 52 47 46 bytes

“=÷¡v⁺ʋiṂYR¤"bİɲ}Ñ1Ṇ⁴ẠV⁹yȥGẇ’“¿mŻ“p’Dx39jBo88V

There are more convoluted approaches in the revision history, but this simple one beats them all.

Try it online!

How it works

“=÷¡v⁺ʋiṂYR¤"bİɲ}Ñ1Ṇ⁴ẠV⁹yȥGẇ’

This is a numeric literal, encoded in bijective base 250, where the digits are taken from Jelly's code page. The chain's (left) argument and the return value are set to the encoded integer,
n := 0x21871c77d7d7af6fafafeff0c37f72ff7fbfbdbfdfef5edfeff8e3.

“¿mŻ“p’

A similar literal to the above one, but the second separates two encoded integers. The return value is replaced with the encoded array, [777711, 113].

Dx39

D converts the return value to decimal ([[7, 7, 7, 7, 1, 1], [1, 1, 3]]), then x39 repeats each individual integer/digit in the result 39 times. This yields a pair of arrays, which contains the digits before and after the 7-character high text, respectively. Let's call this array A.

jB

First, B converts the (left) argument n to binary. This yields the digits that form the 7-character high text, where each 88 has been replaced by 0.

Then, j joins the array A, using the binary array as separator.

o88

This performs logical OR with 88, replacing each 0 with 88.

V

We have the correct digits now, but in an array of 7's, 1's, 88's, and 3's. V implicitly turns this array into a string and then evals it, yielding a single integer.

Dennis

Posted 2017-10-22T20:44:46.313

Reputation: 196 637

6

Bubblegum, 51 bytes

00000000: 331f c4c0 90ba c002 0a90 5986 d818 50d5  3.........Y...P.
00000010: 282c 3406 6e65 5036 1e4b 9195 8109 649d  (,4.neP6.K....d.
00000020: 5858 1896 4279 68b2 f895 61fa 94ca c098  XX..Byh...a.....
00000030: 3800 00                                  8..

Try it online!

ovs

Posted 2017-10-22T20:44:46.313

Reputation: 21 408

6

SOGL V0.12, 52 51 bytes

≡=vā⁷H↕↕jΥ_Ν↑∆∫▲pΖo	‘θδžΟwd╬2n?q[‘²Κ7n⌡"α¼■╤ģ⅞¹‘¹H∑

ties bubblegum!
note that this answer contains a tab

Try it Here!

Tries to save bytes by reusing the same string for both of the Ps.

Explanation:

...‘...‘²Κ7n⌡"..‘¹H∑  compressed strings replaced with ellipses to shorten the width
...‘                  pushes "1111111188888188888888111118811111881111188111118881118818111811111111188888188888888111118811111881111188118118888818818881811118111" - CG
    ...‘              pushes "1111111888888888888881118118111811811181181118118111811811188881111881" - P
        ²             join with itself - double the P
         Κ            reverse add - prepend the PP to CG
          7n          split to line lengths of 7
            ⌡         for each
             "..‘       push "311ŗ117777" with ŗ replaced with the ToS - current item looping over
                 ¹    wrap the results tn an array
                  H   rotate it counter-clockwise
                   ∑  join to a single string

The numbers there are saved as from the original starting at the bottom left, going up, then 1 right & down, then up, ect.

A 52 byte plain compression version:

#⅓→9E■Ν►1&⅝θ⅞%øøμ←N═]y)u⅝↓$A○░(ZF16Φ⅓Mč▓d⅛Hι‼∑υnη▲Z‘

Try it Here!

dzaima

Posted 2017-10-22T20:44:46.313

Reputation: 19 048

I'm not sure if what you've posted is the correct code at all... – Erik the Outgolfer – 2017-10-23T11:32:04.767

1how does ...‘ get those numbers? – Pureferret – 2017-10-23T12:33:14.187

1@Pureferret String compression. – totallyhuman – 2017-10-23T12:44:49.043

@totallyhuman so how does it 'encode'/compress thoses strings into ...‘? – Pureferret – 2017-10-23T13:52:48.420

@dzaima I don't think that actually helps me understand, unfortunately. Entering the first part that encodes the CG into that tool doesn't give ...‘ anywhere in that tool. – Pureferret – 2017-10-23T13:59:28.537

@dzaima yeah, that doesn't give you ...‘ as I expected. I'm trying to figure out which symbols/characters are actually representing your two long stings of numbers, which is still not clear. – Pureferret – 2017-10-23T14:15:35.990

Ah ok. I thought your explanation was using three dots or an elipsis for a special meaning. Thats clearer now! thanks – Pureferret – 2017-10-23T15:44:08.547

4

Mathematica, 107 bytes

Uncompress@"1:eJxTTMoP8ixgYmAwH8TAkLrAAgqQWYbYGFDVGCxkBh5lCDNwWIqqDCyGrAGDhWEpFmXY3IaiDItPqQqMiQMA+yaAoA=="


Try it online!

J42161217

Posted 2017-10-22T20:44:46.313

Reputation: 15 931

Correct me if I'm wrong, but is that a REPL-only solution? That doesn't seem to be a function (which I'm guessing you could fix with a single & on the end). – numbermaniac – 2017-10-26T08:20:11.793

this is not supposed to be a function. this code just outputs the PPCG prime, just like the OP asked – J42161217 – 2017-10-26T09:42:00.363

4

Java (OpenJDK 8), 165 bytes

n->{for(int i=0;++i<566;)System.out.print(i<157?7:i>526?3:i<236|i>446||new java.math.BigInteger("vnku5g6l0zenpa1kydel5rxw162k4fk4xapa154o",36).testBit(446-i)?1:88);}

Try it online!

Credits

  • -10 bytes thanks to aditsu!

Olivier Grégoire

Posted 2017-10-22T20:44:46.313

Reputation: 10 647

165: n->{for(int i=0;++i<566;)System.out.print(i<157?7:i>526?3:i<236|i>446||new java.math.BigInteger("vnku5g6l0zenpa1kydel5rxw162k4fk4xapa154o",36).testBit(446-i)?1:88);} – aditsu quit because SE is EVIL – 2017-10-25T17:20:02.597

Nice catch, the double 88, thanks! – Olivier Grégoire – 2017-10-25T17:56:11.133

4

C, 519 427 414 396 377 bytes

Thanks to Tas, Felix Palmen and Lynn.

#define p(n,l)for(i=40*l;i;)putchar(--i%40?n+48:10);
f(i){p(7,4)p(1,2)puts("188888888118888888811188888811188888811\n188111118818811111881881111881881111881\n188111118818811111881881111111881111111\n188888888118888888811881111111881118888\n188111111118811111111881111111881111881\n188111111118811111111881111881881111881\n188111111118811111111188888811188888811");p(1,2)p(3,1)}

For your interest, here is a longer, easier-to-read version:

#define p(n,l) for(i=40*l;i;) putchar(--i%40?n+48:10);
f(i) {
    p(7,4)
    p(1,2)
    puts("188888888118888888811188888811188888811\n\
       188111118818811111881881111881881111881\n\
       188111118818811111881881111111881111111\n\
       188888888118888888811881111111881118888\n\
       188111111118811111111881111111881111881\n\
       188111111118811111111881111881881111881\n\
       188111111118811111111188888811188888811");
    p(1,2)
    p(3,1)
}

xanoetux

Posted 2017-10-22T20:44:46.313

Reputation: 435

1

You can get much lower (~450ish) by simply printing the 1s and 8s as they are, and having a define for the 7, 3 and 1

– Tas – 2017-10-24T05:34:46.493

@Keyu Gan: I am compiling with a current version of GCC (7.2.0-debian11), which allows this for a couple of years. I'm not quite sure if the syntax is maybe in one of the newer C standards. – xanoetux – 2017-10-24T06:25:24.147

2@Keyu Gan: It is allowed in C99 and C11. – xanoetux – 2017-10-24T06:30:28.383

1414 bytes – Felix Palmen – 2017-10-24T07:25:52.057

This version is very tricky. At least I understand it; thanks. – xanoetux – 2017-10-24T10:40:46.443

Using "new" newlines saves again ~20 bytes – xanoetux – 2017-10-24T10:50:01.940

@xanoetux nice. Suggest to add the submission format from tio :)

– Felix Palmen – 2017-10-24T13:16:00.550

@xanoetux wow i didn’t know that before :p – Keyu Gan – 2017-10-25T07:10:35.030

The code you posted isn’t 396 bytes long. Adding whitespace for readability is a nice idea, but you should show the actual 396 byte code so that it can be verified by others. – Lynn – 2017-10-25T15:07:26.090

@Lynn I was sure I had done so. But you're right, I forgot it at last edit. Here you go – xanoetux – 2017-10-25T15:14:55.330

Anyway, I got down to 377 bytes.

– Lynn – 2017-10-25T15:15:39.753

Yes, as I call puts only once, that actually saves a whole #define – xanoetux – 2017-10-25T15:19:24.680

Yes, I forgot to replace it... I should read my post before posting it :) – xanoetux – 2017-10-25T15:33:16.640

4

CJam, ASCII, 61

Hs78f*~_@"'hfv;HH`>O4RU(_o^.U)9q&-1iadr`4tk"90b2b88fe|1$'339*

Try it online

Append ]s39/N* for nice wrapping.

Explanation:

Hs         generate "17" (H=17)
78f*       repeat each character 78 times, getting an array of 2 strings
~_         dump the 2 strings on the stack, and duplicate the '7's
@          move the '1's to the top of the stack (first 6 lines done so far)
"…"90b     convert that string from base 90 (treating characters as numbers)
2b         convert the resulting number to base 2,
            obtaining a bit map for the "PPCG" part, with 1 for "1" and 0 for "88"
88fe|      replace (boolean OR) all the zeros with 88
1$         copy the string of 78 '1's
'339*      repeat '3' 39 times

aditsu quit because SE is EVIL

Posted 2017-10-22T20:44:46.313

Reputation: 22 326

2

Retina, 129 bytes


h155b78i7b1i7b2i5b2i5b2!4!!4!""1!4!!4!!6#i7b1i7b1!6!2i3b##!6"1##""1#!8i5b2i5b79d38
#
!7
"
!3!
!
i1b
\d+
$*
+`(\D)1
$1$1
1

T`l`d

Try it online!

ovs

Posted 2017-10-22T20:44:46.313

Reputation: 21 408

2

Batch, 364 335 333 bytes

@set a=888888&set b=1111111111111&set e=1881111&set d=1%e%&set f=333333333&for /L %%x in (1,1,156) do @cd|set/p=7
@echo %b%%b%%b%%b%%b%%b%1%a%8811%a%88111%a%111%a%1%d%188%e%188%e%88%e%88%d%188%e%188%e%1%d%1111%a%8811%a%88%d%111881118888%e%11%d%11%d%1%d%88%d%11%d%11%d%88%e%88%d%11%d%11111%a%111%a%%b%%b%%b%%b%%b%%b%11%f%%f%%f%%f%333

schnaader

Posted 2017-10-22T20:44:46.313

Reputation: 1 132

1Save two bytes by changing echo| to cd| – stevefestl – 2017-10-23T13:05:52.007

Thanks, I knew there was something shorter, but couldn't remember – schnaader – 2017-10-23T14:06:14.620

Also, (1,1,156) do can be shortened to (1,1,156)do – stevefestl – 2017-10-23T23:07:18.607

2

Javascript (ES6), 187 181 bytes

-6 bytes thanks to @JustinMariner

r=s=>s[0].repeat(39),a=r`7`,b=r`1`,i="8888881",c=188+i,d=11+i,j="188111",e=j+1188,f=j+188,g=j+111,h=g+1,k=r`3`
z=>"aaaabbccdd1eeff1eeghccgj8888hhgf1hhff1hhdd1bbk".replace(/./g,eval)

Super simple approach; it could probably be golfed some more.

Explanation

r=s=>s[0].repeat(39),                               // helper function to repeat character
a=r`7`,b=r`1`,i="8888881",c=188+i,d=11+i,j="188111",// Set the variables (a-k) to different
e=j+1188,f=j+188,g=j+111,h=g+1,k=r`3`               // parts of the prime       

_=>"aaaabbccdd1eeff1eeghccgj8888hhgf1hhff1hhdd1bbk" // Replace all letters in the string
    .replace(/./g,eval)                             // with the value of the variable

Example code snippet (with some helper code to add line breaks in the output)

r=s=>s[0].repeat(39),a=r`7`,b=r`1`,i="8888881",c=188+i,d=11+i,j="188111",e=j+1188,f=j+188,g=j+111,h=g+1,k=r`3`
z=_=>"aaaabbccdd1eeff1eeghccgj8888hhgf1hhff1hhdd1bbk".replace(/./g,eval)
o.innerText=z().replace(/.{39}/g,"$&\n")
<pre id=o>

Herman L

Posted 2017-10-22T20:44:46.313

Reputation: 3 611

You can save some bytes if you define a helper function r as r=s=>s[0].repeat(39) and then replace a, b, and k with r`7` etc. Try it online!.

– Justin Mariner – 2017-10-23T21:26:44.980

2

C (gcc), 269 267 bytes

function, uses simple RLE.

x[]={39,79,80,156};k;f(i){for(char*c="d7b1882188316831683128512811285128112841281128412821285128112851281128712881882188212871283148112881288128712841282128812881284128112841282128812891683168c1a3";i=*c++;++c)for(i=i<97?i-48:x[i-97];i--;++k%39||puts(""))putchar(*c);}

Try it online!

Felix Palmen

Posted 2017-10-22T20:44:46.313

Reputation: 3 866

Suggest L"'OP\x9c" instead of x – ceilingcat – 2018-09-06T21:04:06.040

2

C (gcc), 224 bytes

f(i,j,c){for(i=0;c="wwdfFdfFDfFDfFDFDDFFDDFFDddDDFdDDddDDddDDDdDDDDffDffDFDDDFDfdDDDDFDDDdDDDdDDFdDDDDFDDDdDDFFDdDFDDDdDDDDdfDdfD"[i/2]>>i++%2*4&15;c-6?putchar(c-4?c+48:49):printf("88"))for(j=0;j++<c%2*38;)putchar(c+48);}

Try it online!

Contains some unprintables, the string literal is "ww\x11dfFdfFDfFDfFDFDDFFDDFFDddDDFdDDddDDddDDDdDDDDffDffDFDDDFDfdDDDDFDDDdDDDdDDFdDDDDFDDDdDDFFDdDFDDDdDDDDdfDdfD\x11\x03".

Lynn

Posted 2017-10-22T20:44:46.313

Reputation: 55 648

1

Jelly, 86 bytes

Lẋ@1,8żḣLẋ/€F
7ẋ156;1ẋ78¤©;“½Ẹ^o“2FẒ⁶ġbȥ“¡E⁷£cṿ“t¡ɗḋ“£F¢Xȥ“¡McṾbȥ“¬3Ṭo’DÇ€F¤;®;3rẋ39¤Ḍ

Try it online!

-12 bytes thanks to user202729

HyperNeutrino

Posted 2017-10-22T20:44:46.313

Reputation: 26 575

88 bytes: TIO ( can separates a list of strings inside a string literal)

– user202729 – 2017-10-23T06:37:14.180

What time is it in your country? Why are you awake right now? – user202729 – 2017-10-23T06:37:38.857

@user202729 Oh right, thanks. And I'm in UTC-4 I did a stupid and had to stay up rly late so I felt like doing a challenge before going to sleep since this got reopened. I can elaborate in chat if you'd like :P – HyperNeutrino – 2017-10-23T06:41:20.110

1

Python 2, 309 158 155 136 135 bytes

x='1'*78
s='7'*156+x
a=1
for c in str(int('109PDKEZ3U32K97KJQVELW8GKXCD42EGEYK715B6HPMPL0H8RU',36)):s+=`a`*int(c);a^=9
print s+x+'3'*39

Try it online!

Python 2, 137 bytes

s='7'*156
a=1
for c in'90'*8+str(int('PL6PU5TXIC24LCKIQY50C2LPAIC9TVZEVQGTMM63IHGBBUV1XSA6',36))+'09'*8:s+=`a`*int(c);a^=9
print s+'3'*39

Try it online!

TFeld

Posted 2017-10-22T20:44:46.313

Reputation: 19 246

1

Jelly, 85 bytes

”7ẋ“ɓ’80“¡Ȯ⁶LÑɓĠ⁶-€Øġ°$¤ṛọḳƓƒṭ⁽@^ḥ⁷Ofạ<e½Ṇż;,RṘ¶ṀḊ+`⁸ⱮḃĿþṛ9.wƑ¡kḟUẎgLLµ’ḃĖŒṙị⁾1839”3ẋ

Try it online!

Based on Dennis's approach to the Trinity Hall challenge, minus the symmetry, plus the leading 7s and trailing 3s.

Erik the Outgolfer

Posted 2017-10-22T20:44:46.313

Reputation: 38 134

3Dennis approached this challenge differently because it is a different one. I think you've been outgolfed! – None – 2017-10-23T13:28:12.470

@JoseZaman He made Jelly BTW. – Erik the Outgolfer – 2017-10-23T14:26:11.693

1

PowerShell, 164 bytes

$a='136361616151315131531532513151315215436365213213315454521532545453153254541616';6..2|%{$a=$a-replace$_,(11,88,22,34,3332)[$_-2]};'7'*156+'1'*78+$a+'1'*78+'3'*39

Try it online!

String multiplication, concatenation, and replacements. PowerShell doesn't have base 36 or similar, so large-number compression options are limited. There might be a better way to "compress" the middle part -- I'm still checking on that.

AdmBorkBork

Posted 2017-10-22T20:44:46.313

Reputation: 41 581

1

Wolfram Language (Mathematica), 89 (17+71+1) bytes

First you export the number to a GZIP file. This file, named "o" with no extension will be exactly 71 bytes, which counts towards the total. By default, it will go to your $TemporaryDirectory. Omitting digits for readability.

Export["o",777777...,"GZIP"]

Then

"o"~Import~"GZIP"

will reconstruct the number. The file name is one byte so that's where the +1 comes from.

Try it online!

Kelly Lowder

Posted 2017-10-22T20:44:46.313

Reputation: 3 225

1

Ruby, 109 bytes

The script calls Zlib.inflate to decompress the number. It needs at least Ruby 1.9.3. It contains unprintable bytes, so I can't paste it here.

I paste the output of vis prime-inflate.rb:

require'zlib'
puts Zlib.inflate DATA.read
__END__
x\M-Z37\^_\M-<\M-@\M^P\M-:\M-@\^B
\M^PY\M^F\M-X\^XP\M-U\^X,d\^F\^^e\^H3pX\M^J\M-*\^L,\M^F\M-,\^A\M^C\M^Ea)\^Ve\M-X\M-\\M^F\M-"\^L\M^KO\M-)
\M^L\M^I\^C\^@\^P\M-p~\M-!

If you have unvis(1), run unvis prime-inflate.vis > prime-inflate.rb to restore the 109-byte script. Or you can decode the Base64, below, with ruby -e 'print *STDIN.read.unpack(?m)' < prime-inflate.b64 > prime-inflate.rb.

cmVxdWlyZSd6bGliJwpwdXRzIFpsaWIuaW5mbGF0ZSBEQVRBLnJlYWQKX19F
TkRfXwp42jM3H7zAkLrAAgqQWYbYGFDVGCxkBh5lCDNwWIqqDCyGrAGDhWEp
FmXY3IaiDItPqQqMiQMAEPB+oQ==

I call Zlib.inflate so I don't need to design and golf my own decompression algorithm. I use DATA with __END__ because the compressed string isn't valid UTF-8. Ruby code must be valid ASCII (in Ruby 1.9.x) or UTF-8 (from Ruby 2.0) or have a magic comment #coding:binary to change the encoding, but Ruby doesn't check the encoding after __END__.

kernigh

Posted 2017-10-22T20:44:46.313

Reputation: 2 615

1

6502 machine code (C64), 142 122 bytes

00 C0 A9 27 85 FB A2 00 86 FC A2 04 CA 10 01 60 BC 70 C0 BD 74 C0 20 D2 FF C6
FB D0 0B 48 A9 27 85 FB A9 0D 20 D2 FF 68 88 D0 EB E0 02 D0 DD 48 A5 FC 4A A8
B9 4A C0 90 04 4A 4A 4A 4A 29 0F F0 08 E6 FC A8 68 49 09 D0 CD 68 D0 C0 28 38
36 36 52 12 52 12 42 12 42 22 52 12 52 12 72 82 28 28 72 32 14 82 82 72 42 22
82 82 42 12 42 22 82 92 36 06 27 50 4F 9C 33 31 31 37

Online demo

Usage: sys49152

  • -20 bytes with better implementation of same method and data tables for large blocks as well.

Explanation

This also uses the lengths of the 1 and 8 sequences in the middle part; as they're all shorter than 16, two of them are encoded per byte.

Commented disassembly listing:

         00 C0        .WORD $C000       ; load address
.C:c000  A9 27        LDA #$27          ; counter for newlines (39)
.C:c002  85 FB        STA $FB
.C:c004  A2 00        LDX #$00          ; index for run-length data
.C:c006  86 FC        STX $FC
.C:c008  A2 04        LDX #$04          ; index for "blocks" (counting down)
.C:c00a   .blockloop:
.C:c00a  CA           DEX
.C:c00b  10 01        BPL .continue     ; block index underflow -> done
.C:c00d  60           RTS
.C:c00e   .continue:
.C:c00e  BC 70 C0     LDY .lseqlens,X   ; load length of next block to Y
.C:c011  BD 74 C0     LDA .chars,X      ; load character of next block to A
.C:c014   .outloop:
.C:c014  20 D2 FF     JSR $FFD2         ; output character
.C:c017  C6 FB        DEC $FB           ; decrement newline counter
.C:c019  D0 0B        BNE .skipnl
.C:c01b  48           PHA               ; newline needed -> save accu
.C:c01c  A9 27        LDA #$27          ; restore newline counter
.C:c01e  85 FB        STA $FB
.C:c020  A9 0D        LDA #$0D          ; load newline character
.C:c022  20 D2 FF     JSR $FFD2         ; output character
.C:c025  68           PLA               ; restore accu
.C:c026   .skipnl:
.C:c026  88           DEY               ; decrement repeat counter
.C:c027  D0 EB        BNE .outloop      ; repeat until 0
.C:c029  E0 02        CPX #$02          ; check for block index of text part
.C:c02b  D0 DD        BNE .blockloop    ; not in text part -> repeat
.C:c02d   .textpart:
.C:c02d  48           PHA               ; save accu
.C:c02e  A5 FC        LDA $FC           ; load index for run-length data
.C:c030  4A           LSR A             ; and shift right
.C:c031  A8           TAY               ; -> to Y register
.C:c032  B9 4A C0     LDA .seqlens,Y    ; load run-length data
.C:c035  90 04        BCC .lownibble    ; carry clear from shift -> low nibble
.C:c037  4A           LSR A             ; shift high nibble into low nibble
.C:c038  4A           LSR A
.C:c039  4A           LSR A
.C:c03a  4A           LSR A
.C:c03b   .lownibble:
.C:c03b  29 0F        AND #$0F          ; mask low nibble
.C:c03d  F0 08        BEQ .textdone     ; run-length zero? then text block done
.C:c03f  E6 FC        INC $FC           ; increment index for run-length data
.C:c041  A8           TAY               ; run-length to y-register
.C:c042  68           PLA               ; restore accu
.C:c043  49 09        EOR #$09          ; toggle between '8' and '1'
.C:c045  D0 CD        BNE .outloop      ; and back to output loop
.C:c047   .textdone:
.C:c047  68           PLA               ; restore accu
.C:c048  D0 C0        BNE .blockloop    ; back to loop for next block
.C:c04a   .seqlens:
.C:c04a  28 38 36 36  .BYTE $28,$38,$36,$36
.C:c04e  52 12 52 12  .BYTE $52,$12,$52,$12
.C:c052  42 12 42 22  .BYTE $42,$12,$42,$22
.C:c056  52 12 52 12  .BYTE $52,$12,$52,$12
.C:c05a  72 82 28 28  .BYTE $52,$82,$28,$28
.C:c05e  72 32 14 82  .BYTE $72,$32,$14,$82
.C:c062  82 72 42 22  .BYTE $82,$72,$42,$22
.C:c066  82 82 42 12  .BYTE $82,$82,$42,$12
.C:c06a  42 22 82 92  .BYTE $42,$22,$82,$92
.C:c06e  36 06        .BYTE $36,$06
.C:c070   .lseqlens:
.C:c070  27 50 4F 9C  .BYTE $27,$50,$4F,$9C
.C:c074   .chars:
.C:c074  33 31 31 37  .BYTE "3117"

Felix Palmen

Posted 2017-10-22T20:44:46.313

Reputation: 3 866

1

Python 2, 112 bytes

print'7'*156+'1'*78+bin(int('JAOKI5B0O6K9IWDU8P76KDLR0VZMNWQ2WB9D8BOS8',36))[2:].replace('0','88')+'1'*80+'3'*39

Try it online!

Lynn

Posted 2017-10-22T20:44:46.313

Reputation: 55 648

1

C (gcc), 188 187 185 bytes

-1 thanks to JonathanFrech.

-2 thanks to ceilingcat.

#define F(c,n)for(c=0;c<n;c++)
i,j,k;r(d,n){F(k,n)printf("%d",d);}f(){r(7,156);r(1,79);F(i,45)F(j,6)r("pdpi8pIa7]R>=4gQ>Q2iPoX2=O4a1=QRJ17QR>=4a1i8p"[i]-49>>j&1?8:1,1);r(1,80);r(3,39);}

Try it online!

gastropner

Posted 2017-10-22T20:44:46.313

Reputation: 3 264

2Welcome to PPCG, nice first answer! – ovs – 2017-11-07T19:15:28.333

I think you can shift your string to get to a string which does not need escaping a backslash, resulting in 187 bytes.

– Jonathan Frech – 2017-11-07T21:03:31.433

@JonathanFrech Ah, nice one! – gastropner – 2017-11-08T11:56:49.010

@ceilingcat Good catch! – gastropner – 2018-08-21T05:52:04.393

0

Python 2, 244 128 120 bytes

-8 bytes thanks to @JonathanFrech

s='1'*78
print'7'*156+s+bin(int("8zlghh9gqo74zwzntkcjmoou35vvlbg1cmasrm6ny1iafcvw568sj",36))[2:].replace(*'08')+s+'3'*39

Try it online!

ovs

Posted 2017-10-22T20:44:46.313

Reputation: 21 408

120 bytes. – Jonathan Frech – 2017-10-23T10:47:55.177

0

Befunge-93, 500 bytes

v F         >20g1-20p
>"3"20g10g`#^_>52*"F"20p30g10g`#v_"^!1"21p30p84*2+1p
^                       p03-1g03<
^>"81118888888811888888881>!"30p84*2+1p52*
^^"8888811188888811"*25"188111118"<>">#7"21p30p57*5p
>*"188111188188111188188111118818"^ $>:#,_@
^25"18811111881881111188188111111"<
>"8888811888888881"25*"1111111881"^
^"88811881111111881118888"*25"188"<
>"1188111111188111111118811111111"^
^"11881"*52"188111111118811111111"<
>"11111881"52*"188111188188111188"^
^"1118811111111188888811188888811"<

Try it online!

ItsJ0el

Posted 2017-10-22T20:44:46.313

Reputation: 95