Skip to content

Instantly share code, notes, and snippets.

@phu54321
Created October 7, 2017 12:59
Show Gist options
  • Save phu54321/1f0e05fa859298200739a6df690541d4 to your computer and use it in GitHub Desktop.
Save phu54321/1f0e05fa859298200739a6df690541d4 to your computer and use it in GitHub Desktop.
Prime generating quine
// Simple prime generatine quine example.
char *f="?1?2?0=5755?/(?75=?5='!??5?'%?",*r="aeaaaaaaa",a[]="c*d(%%e%y]0q9=("
"05;t/\"nf<(<u*(ip;ru}lrhr+)i7(3<[;!22*);}c(,=o7*1+u1fu}(tes+a=1{=5+]1xf=);q"
";pih?c$r5p5i;0(te3cle+r\"5;=8+>0/o0;p)prfa7[,(8-;%x)*cl4hs ; a,m0]p>;4r;pu;"
"ui(r57mi;-i3+;phs)ae{p*e*=);<(y](qutxtnx(=5,=i=+]+}=ae;r xufaqnbwdi+?p+tc+c"
"t+1?8x2+n+=)p=r }(i+t=a,;rh+/+4=+ch+hf*05+,;+%)1pu6(ie3f+c\"abwei13)7c)ha;a"
"(r)=1yi)1i;ut49fl4(;h?a[hal6){:;{ar}r\"-;'],<c0futc)2(s)*pa1a5ike))f3*ir(i("
"%9r!,um[)(+ch{)*e;pur?a]l;({&o2pf(9f3d7e?d=;i)(=haf;q p=t(2a[efnf1r)!(12(4\""
">t?[0i]/f4arop={u=c1?\"8(o>o)(;=*1)x),7u51,+=1[;r(ru=pt3h00,0ir0rbxp0q0;>;m"
"8r?6i+a0*}(1(t3uc6a)=a]!()([=u;=)p=x-)n'];)[;pfb0qc4th)r;5[;=inii0tp=;u7=1{"
" %,mi3w*o[)=h)ca{(}7]im===/;c+1xt61)x0?*af7h3ry;aa{hrx*}5=n+0(03xh+0+c);;=;"
"\"pi(*i+(/x;rxa(+pp5\"t+;n;]<a))=h{}}0},=nmili;2=*(+r1=)u?@ )i-i[4r{{3ap}e;"
"",c[758+1],d[16],*p=d+15,*q,b[5][80];int n=2,m,x,y,u=0,i;main(){;m=n;while
(i!=m++)for(i=2;i<m;i++)if(m%i==0)break;for(i=0;i<758;i++)c[i]=a[37*i%758];
while(n>0)n=(n-(*p--=n%10))/10;while(++p<d+16){for(i=0;i<15;i++)if((f[*p*3+i%3]
>>(i/3))&1)b[i/3][u+i%3]=1;u+=4;}for(;y<10;y++){for(x=0;x<4*u;x++)putchar(b[y/2
][x/4]?47:32);putchar(10);}putchar(10);x=0;for(p=c;*p!=0;p++){if(*p==64){for(q=
a;*q!=0;q++){if(*q==10){putchar(92);putchar(92);putchar(110);x+=3;}else if(*q==
34){x+=2;putchar(92);putchar(34);}else {putchar(*q);x++;}if(x>=76){putchar(34);
putchar(10);putchar(34);x=1;}}}else if(*p==36){x+=5;printf("%d",m-1);}else {x++
;putchar(*p);}if(x+*r-97>78){x=0;r++;putchar(10);}}putchar(10);return 0;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment