Print all numbers from -100 to 100 which contain a given digit
Whitespace, 834 characters (0 if you subtract whitespaces)
Used this interpreter to test it.
This took me some 4 hour of hard work and horrible debugging to create. But it is done!
EDIT: Selectable text provided with HTML tricks. If you copy and paste it from here to some other place, please check if you got exactly [space][tab][linefeed][linefeed][linefeed]
at the end with 100 or 101 lines (depending if your editor counts or not a new line if the last one ends with a linefeed).
In the case that you can't use it this way, considering space as S
, linefeed as L
and tab as T
, and breaking lines after the L
's, here it is:
SSSTSSSSTSL
SSSTSSSSTSL
TL
TSSSSTSSSSTSL
TTTSSSTTSSSSL
TSSTTTSSSSTSSSSTTL
SSTTTSSSTTL
TTSSSSTSSSSSTL
SSSL
TTSSSSTSSSSTSL
TTTL
TSSTSSTSTTL
SSSTSSSSTSL
TTTSSSTL
TSSTL
TSSTSSTSTTL
L
SSSTSSSTSSL
SSSTSSSSTTL
TTTSL
SSSSTTSSTSSL
TSSTL
TSSTSSSTSTL
SL
SSSTTL
TSSL
L
TTSTSSSTTTL
SSTTL
TSSL
L
SSSTSSSTTTL
SL
SSSSTSSSSTSL
TTTL
TSSTSSTSSSL
SSSTSTSL
TSTSSSSTSSSSTSL
TTTTSSTL
TSSTSSTSSTL
L
SSSTSSTSSSL
SSSTSTSL
TSTTSSSTSSSSTSL
TTTTSSTL
TSSTSSTSSTL
L
SL
STSSTSTSL
L
SSSTSSTSSTL
SSSTSSSSSTL
TTTL
TSSTSSSTTSL
SSSTSSSSSL
TL
SSL
SSSTSSSTTSL
SSSTSSSSSTL
SSSTL
TTSSSSTSSSSTTL
TTTTL
STL
SSSTSSTSTSL
SSSTSSSSTTL
SSSTSSSSTTL
TTTSSSTL
TSSSTTSL
SL
STSSSTSSL
L
SSSTSSSTSTL
SSSTSSSSTSL
TTTL
TSSTSSTTSSL
SSSTSSSSTSL
TTTSSSTL
TSSTL
TSSTSSTTSSL
L
L
L
L
SSSTSSTSTTL
SSTTTSSTSSL
TL
STSSSTSSSSSL
TL
SSL
SL
STSSSTSSL
L
SSSTSSTTSSL
SSSTSSSSSL
TL
SSSSSTTSSTSSL
TL
STL
L
L
Bash+utils - 20
seq -100 100|grep 9
Or 21 bytes if in a script
seq -100 100|grep $1
To run the script:
sh myscript 9
JavaScript 133 - 1 = 132
Surely there couldn't possibly be anything wrong with this version now...?
for(k=prompt(),c=console,j=-100;100>=j;j++)if(i=j,0==j&j==k)c.log(0);else for(;i;)if(h=i%10,h=0>h?-h:h,i=i/10|0,h==k){c.log(j);break}
PROMPT: 2
CONSOLE.LOG:
-92
-82
-72
-62
-52
-42
-32
-29
-28
-27
-26
-25
-24
-23
-22
-21
-20
-12
-2
2
12
20
21
22
23
24
25
26
27
28
29
32
42
52
62
72
82
92
CONTROL, using zero
PROMPT: 0
CONSOLE.LOG:
-100
-90
-80
-70
-60
-50
-40
-30
-20
-10
0
10
20
30
40
50
60
70
80
90
100