Display numbers lacking 2's

Taxi, 2399 2391 2370 1783 1773 1706 bytes

-8 bytes for realizing that, instead of leaving a certain passenger at Sunny Side Park forever, it's more worth it to throw them off of Riverview Bridge. Ah, what a lovely town this is.

-21 bytes for taking out a comment I stupidly left in.

-587 bytes by simply changing the entire way I went about this (apparently a shorter way is by arithmetic; integer-dividing [17, 27, 37, 47,...] by 9 yields the sequence, but you gotta skip over the 20's yourself.)

-17 bytes for the realization that any quotes-encased string without a space doesn't need quotes after all (thanks Jo King!).

-67 bytes for the realization that linebreaks are optional.

17 is waiting at Starchild Numerology.Go to Starchild Numerology:w 1 l 2 r 1 l 1 l 2 l.Pickup a passenger going to Cyclone.Go to Cyclone:e 1 l 2 r.[B]Pickup a passenger going to Cyclone.Pickup a passenger going to Divide and Conquer.9 is waiting at Starchild Numerology.Go to Starchild Numerology:s 2 l 2 r.Pickup a passenger going to Divide and Conquer.Go to Divide and Conquer:e 1 l 2 r 3 r 2 r 1 r.Pickup a passenger going to Trunkers.Go to Trunkers:e 1 r 3 r 1 l.Pickup a passenger going to The Babelfishery.Go to The Babelfishery:e 1 r 1 r.Pickup a passenger going to Post Office.\n is waiting at Writer's Depot.Go to Writer's Depot:n 5 l 2 l.Pickup a passenger going to Post Office.Go to Post Office:n 1 r 2 r 1 l.Go to Cyclone:s 1 r 1 l 2 r.Pickup a passenger going to Addition Alley.Pickup a passenger going to Equal's Corner.177 is waiting at Starchild Numerology.Go to Starchild Numerology:s 2 l 2 r.Pickup a passenger going to Equal's Corner.Go to Equal's Corner:w 1 l.Switch to plan C if no one is waiting.Pickup a passenger going to Sunny Skies Park.100 is waiting at Starchild Numerology.Switch to plan D.[C]10 is waiting at Starchild Numerology.[D]Go to Starchild Numerology:n 1 r.Pickup a passenger going to Addition Alley.Go to Sunny Skies Park:w 1 r.Go to Addition Alley:n 1 r 1 r 1 r.Pickup a passenger going to Cyclone.Go to Cyclone:n 1 l 1 l.Pickup a passenger going to Cyclone.Pickup a passenger going to Equal's Corner.917 is waiting at Starchild Numerology.Go to Starchild Numerology:s 2 l 2 r.Pickup a passenger going to Equal's Corner.Go to Equal's Corner:w 1 l.Switch to plan E if no one is waiting.Switch to plan F.[E]Go to Go More:n 1 l.Go to Cyclone:w 1 r.Switch to plan B.[F]

Try it online!

This one isn't winning me any code golf competitions anytime soon, but I decided to try out the esolang Taxi.

Taxi is an esolang in which all programming is done by picking up and dropping off passengers at various stops in the fictional town of Townsburg. Of course, your taxicab will sometimes run out of gas, so you also need to visit gas stations every so often, and pay using the credits you receive as fare (in this case, I only need to stop for gas - at Go More - once per loop iteration!).

I used some tricks that reduce the filesize a bit, such as rephrasing directions like east 1st left, 2nd right as e 1 l 2 r, removing the word the where it is optional, and using the least complicated route towards all of my destinations (not necessarily the shortest path).

I hate this shorter solution more than the one I originally came up with. This solution down here is a more general way of accomplishing the task, which could start and end anywhere you want. Here it is, in its entirety.

2245 bytes (way more general)

1 is waiting at Starchild Numerology.Go to Starchild Numerology:w 1 l 2 r 1 l 1 l 2 l.Pickup a passenger going to Cyclone.Go to Cyclone:e 1 l 2 r.[B]Pickup a passenger going to Addition Alley.Pickup a passenger going to The Babelfishery.Go to The Babelfishery:n 2 r 2 r.Pickup a passenger going to Cyclone.Go to Cyclone:n 5 l 2 l.Pickup a passenger going to Chop Suey.Go to Zoom Zoom:n.0 is waiting at Writer's Depot.Go to Writer's Depot:w.Pickup a passenger going to Narrow Path Park.Go to Narrow Path Park:n 3 r 1 l 1 r.Go to Chop Suey:e 1 r 1 l 1 r.[C]Switch to plan E if no one is waiting.Pickup a passenger going to Crime Lab.2 is waiting at Writer's Depot.Go to Writer's Depot:n 1 l 3 l.Pickup a passenger going to Crime Lab.Go to Crime Lab:n 3 r 2 r.Switch to plan D if no one is waiting.Pickup a passenger going to KonKat's.Go to Narrow Path Park:n 5 l.Pickup a passenger going to KonKat's.Go to KonKat's:e 1 r.Pickup a passenger going to Narrow Path Park.Go to Narrow Path Park:n 2 l.Go to Chop Suey:e 1 r 1 l 1 r.Switch to plan C.[D]Go to Chop Suey:n 5 r 1 l.Switch to plan C.[E]Go to Narrow Path Park:n 1 l 1 r 1 l.Pickup a passenger going to Crime Lab.0 is waiting at Writer's Depot.Go to Writer's Depot:w 1 l 1 r 2 l.1 is waiting at Starchild Numerology.Pickup a passenger going to Crime Lab.Go to Crime Lab:n 3 r 2 r.Switch to plan F if no one is waiting.Pickup a passenger going to Riverview Bridge.Go to Cyclone:n 4 l 2 l.Pickup a passenger going to Post Office.Go to Riverview Bridge:n 2 r.\n is waiting at Writer's Depot.Go to Writer's Depot:w 2 l.Pickup a passenger going to Post Office.Go to Post Office:n 1 r 2 r 1 l.Go to Starchild Numerology:s 1 r 1 l 1 l 2 l.Switch to plan G.[F]Go to Cyclone:s 1 r 1 l 2 r.Pickup a passenger going to Riverview Bridge.Go to Riverview Bridge:n 2 r.Go to Starchild Numerology:w 2 l 3 l 2 r.[G]Pickup a passenger going to Addition Alley.Go to Addition Alley:e 1 l 2 r 3 r 1 r.Pickup a passenger going to Magic Eight.101 is waiting at Starchild Numerology.Go to Starchild Numerology:n 1 l 1 l 3 l 2 r.Pickup a passenger going to Magic Eight.Go to Magic Eight:w 1 r 2 r 1 r.Switch to plan H if no one is waiting.Pickup a passenger going to Cyclone.Go to Cyclone:n 1 l 2 r.Switch to plan B.[H]

Try it online!

And if mega-cheating is allowed, this one is way shorter than either of the last two.

456 bytes (totally cheating)

1\n3\n4\n5\n6\n7\n8\n9\n10\n11\n13\n14\n15\n16\n17\n18\n19\n30\n31\n33\n34\n35\n36\n37\n38\n39\n40\n41\n43\n44\n45\n46\n47\n48\n49\n50\n51\n53\n54\n55\n56\n57\n58\n59\n60\n61\n63\n64\n65\n66\n67\n68\n69\n70\n71\n73\n74\n75\n76\n77\n78\n79\n80\n81\n83\n84\n85\n86\n87\n88\n89\n90\n91\n93\n94\n95\n96\n97\n98\n99\n100 is waiting at Writer's Depot.Go to Writer's Depot:w 1 l 2 r 1 l 2 l.Pickup a passenger going to Post Office.Go to Post Office:n 1 r 2 r 1 l.

Try it online!


Python 2, 39 bytes

k=7
exec"k+=10;print(k>177)*10+k/9;"*81

Try it online!

Uses arithmetic operations only to generate numbers without 2's.

The value k follows the arithmetic progression 17, 27, 37, 47, ..., which when floor-divided by 9 gives 1,3,4,5,6,7,8,9,10,11,13,14,... which counts up numbers not ending in 2. To skip 20 through 29, outputs are increased by 10 past a certain threshold.


JavaScript (ES6), 43 bytes

Returns the sequence as a comma-separated string.

f=(n=98)=>n?f(n-=n-27?n%10?1:2:11)+[,n+3]:1

Try it online!

Why doing it this way?

We could iterate from \$1\$ to \$100\$ and test each number with /2/.test(n), which is a rather concise statement. But in this scenario, we'd have to handle empty entries with something like (/2/.test(n)?'':...), which adds a couple more bytes.

For example, this would work for 45 bytes:

f=(n=1)=>n>99?n:(/2/.test(n)?'':[n,,])+f(n+1)

Or this would work for 44 bytes, if a leading comma is acceptable:

f=(n=100)=>n?f(n-1)+(/2/.test(n)?'':[,n]):''

All in all (and until proven otherwise), it turns out to be shorter to skip right away all values of \$n\$ that contain a \$2\$.

Commented

f =                 // f is a recursive function taking:
(n = 98) =>         // n = counter, initialized to 98
  n ?               // if n is not equal to 0:
    f(              //   prepend the result of a recursive call:
      n -=          //     update n:
        n - 27 ?    //       if n is not equal to 27:
          n % 10 ?  //         if n is not a multiple of 10:
            1       //           subtract 1 from n
          :         //         else:
            2       //           subtract 2 from n
        :           //       else (n = 27):
          11        //         subtract 11 from n (--> 16)
    ) +             //   end of recursive call
    [, n + 3]       //   append a comma, followed by n + 3; notice that this is the value
                    //   of n *after* it was updated for the recursive call; at the first
                    //   iteration, we have: n = 98 -> updated to 97 -> n + 3 = 100
  :                 // else (n = 0):
    1               //   output the first term '1' and stop recursion