Looks fine to me although with just numbers it can be a bit obscure to look at. Maybe you're not fully understanding how exactly the auto47 works. The default tilemap graphic has a functioning example in place, why not use that as reference?
Tile 1 and tile 29 fulfill different cases.
Here's a placeholder I made some time ago for a 20x20 grid. The dark parts are inside, the bright parts are the edges/outside.