implement num_to_ip function