Perfect arithmetic codes