Abstract:$AN$ codes over an arbitrary base $r$ are discussed. A unique canonical $r$-ary representation having a minimum number of nonzero terms is found for the number $N$. An expression is obtained for the minimum distance of $r$-ary $AN$ codes with large distance for two metrics: arithmetic and Hamming.