# Display numbers lacking 2's

Display numbers from one to one-hundred (in increasing order), but number 2 shouldn’t appear anywhere in the sequence. So, for example, the numbers two (2) or twenty-three (23) shouldn't be in the sequence.

Here is an example output, with newlines separating the numbers:

1
3
4
5
6
7
8
9
10
11
13
14
15
16
17
18
19
30
31
33
34
35
36
37
38
39
40
41
43
44
45
46
47
48
49
50
51
53
54
55
56
57
58
59
60
61
63
64
65
66
67
68
69
70
71
73
74
75
76
77
78
79
80
81
83
84
85
86
87
88
89
90
91
93
94
95
96
97
98
99
100

• I assume the winning criteria is code-golf right? – Luis felipe De jesus Munoz Oct 2 '18 at 13:26
• Our site does not work the same way as other sites from the Stack Exchange network. Regarding accepted answers, please take this comment from Jonathan Allan into account. And please add a winning criterion. – Arnauld Oct 2 '18 at 14:08
• Might I suggest using the Sandbox in the future to get feedback on your challenges before posting? – Jo King Oct 2 '18 at 14:15
• @Monolica If the shortest answer wins, you'll need the tag [code-golf]. Here is a list for all available winning criteria tags for future reference. – Kevin Cruijssen Oct 2 '18 at 14:19
• @user202729 Arbitrary restriction is unwelcome, not disallowed. – Jonathan Frech Oct 3 '18 at 1:11

# JavaScript (Node.js), 45 44 bytes

-1 byte thanks to Neil

for(i=0;i++<100;)/2/.test(i)||console.log(i)


Try it online!

• Can you not use || instead of ?0:? – Neil Oct 7 '18 at 20:33

_=>${[...Array(101).keys()]}.replace(/^0,|\d?2.?,/g,'')  Try it online! # Windows Batch, 49 48 bytes @for /l %%G in (1,1,100)do @echo %%G|find /v "2"  Loops from 1 to 100, and for each number looped, only output those who does not contain any "2". 1 byte is saved by @Neil. • You don't need that ~ do you? – Neil Oct 7 '18 at 20:35 • Oh! You're right. It looks like I have forgotten how to code golf. – stevefestl Oct 9 '18 at 13:14 # SmileBASIC, 50 bytes @L N=N+1IF.>INSTR(STR$(N),"2")THEN?N
ON N>99GOTO@L


### Explanation:

@LABEL
N = N + 1
IF 0 > INSTR(STR$(N), "2") THEN PRINT N ON N>99 GOTO @LABEL  INSTR(STR$(N), "2") is -1 if N doesn't contain a 2.

ON ... GOTO takes a list of labels, and jumps to a label in that list corresponding to the value of an expression.
If N isn't greater than 99, N>99 returns 0 so it jumps to the 0th label, @LABEL.
Otherwise, N>99 is 1 so it tries to jump to label 1 in the list, but since the list isn't long enough, it doesn't jump and the program ends.

ON is meant to be used like switch/case, with a longer list of labels. But ON x GOTO @LABEL can be used as a shorter way of writing IF !(x) GOTO @LABEL:

IF N<=99GOTO@L
IF N<100GOTO@L
ON N>99GOTO@L


# ink, 34 bytes

-(i){("{i}"!?"2"):{i}}
{i<100:->i}


Try it online!

### Explanation

-(i)             // Labelled gather - keeps track of how many times it's been visited (in variable i)
{"{i}"!?"2":     // If "2" is not a substring of i...
{i}              // ...print i
}
{i<100:->i}      // If i is less than 100, go back to i.


# Vim, 18 bytes/keystrokes

100o0<esc>V{g<C-a>J:g/2/d<cr>


Try it online!

## C++, 84 81 bytes

-3 bytes thanks to ceilingcat

The function needs a void return value to compile with MSVC

#include<cstdio>
void f(){for(int i=0;++i<101;)i%10-2&&i/10-2&&printf("%d\n",i);}


The if read as "if the first digit isn't 2 and the second digit isn't 2"