3 (AndrewBayly)
Jump to navigation
Jump to search
- Not to be confused with 3 (islptng) (a language discovered by islptng), or a joke language named "3" where every program prints "3". See 6.
3 is an esoteric programming language which is a subset of JavaScript. In 3, every sequence of 3 consecutive characters must contain at least one 3.
Sample Programs
Hello, world!
_3='3f3i3n3d3c3o3s3t3r3u3e3l3.3g3(3"3H3 3W3r3)3!3' 3 f3=_3[3/3] 3 i3=_3[3] 3 n3=_3[3+3/3+3/3] 3 d3=_3[3+3+3/3] 3 c3=_3[3*3] 3 o3=_3[3*3+3/3+3/3] 3 s3=_3[3*3+3+3/3] 3 t3=_3[3*3+3+3] 3 r3=_3[3*3+3*3-3/3] 3 u3=_3[3*3+3*3+3/3] 3 e3=_3[3*3+3*3+3] 3 l3=_3[3*3*3-3-3/3] 3 D3=_3[3*3*3-3+3/3] 3 g3=_3[3*3*3] 3 O3=_3[3*3*3+3-3/3] 3 Q3=_3[3*3*3+3+3/3] 3 H3=_3[3*3*3+3+3] 3 S3=_3[3*3*3+3*3-3/3] 3 W3=_3[3*3*3+3*3+3/3] 3 r3=_3[3*3*3+3*3+3] 3 C3=_3[3*3*3+3*3+3+3-3/3] 3 E3=_3[3*3*3+3*3+3+3+3/3] 3 F33=f3+i3+n3+d3 C33=c3+o3+n3+s3+t3+r3+u3+c3+t3+o3+r3 a33=c3+o3+n3+s3+o3+l3+e3+D3+l3+o3+g3+O3+Q3+H3+e3+l3+l3+o3+S3+W3+o3+r3+l3+d3+E3+Q3+C3 b33=[3] 3 c33=b33[F33] 3 d33=c33[C33] 3 e33=d33(a33) 3 f33=e33(3) 3
Computational class
Arbitrary integers can be built from 3+-/
by adding and subtracting 3/3
. You can then get most characters by doing this:
q3="3\"3"[3/3] 3
The remaining characters can be done like so:
// Assuming A3 contains "A", b3 contains "b", etc. a33=A3[c3+o3+n3+s3+t3+r3+u3+c3+t3+o3+r3][3,f3+r3+o3+m3+C3+o3+d3+e3+P3+o3+i3+n3+t3](3/3+3/3+3/3+[...]) 3
This allows for arbitrary JS to be run, which proves that 3 is Turing-complete:
F33="3"[3,a3+t3][3,c3+o3+n3+s3+t3+r3+u3+c3+t3+o3+r3] 3 F33([...])(3)