Yes, IDs should be unique for each element on a page, so you should set them twice: one for each field (considering that the function will be invoked only once per page).
Here’s a streamlined version:
function prezzo_minimo_meta_box_render($post) {
// Retrieve meta values
$number = get_post_meta($post->ID, "function_prezzo_primo", true);
$number2 = get_post_meta($post->ID, "function_prezzo_primo_dom", true);
// Initialize the output variable
$output = '';
// Generate the output for the number field
if (!empty($number)) {
$value = round($number / 7, 0);
$output = '<div><input type="number" id="input_prezzo_primo" value="' . esc_attr($value) . '" placeholder="prezzo/notte in euro" /></div>';
} elseif (!empty($number2)) {
$value = round($number2 / 7, 0);
$output = '<div><input type="number" id="input_prezzo_primo_dom" value="' . esc_attr($value) . '" placeholder="prezzo/notte in euro" /></div>';
}
// Output the result
if (!empty($output)) {
echo $output;
}
}