Ugly numbers: initial version