a032981 n = a032981_list !! (n-1)

a032981_list = map read $ filter f $ map show [1..] :: [Int] where

   f ps = all (`elem` neighbours) $ zipWith ((. return) . (:)) ps (tail ps)

   neighbours = "09" : "90" : zipWith ((. return) . (:))

      (digs ++ tail digs ++ init digs) (digs ++ init digs ++ tail digs)

   digs = "0123456789"