# Custom function to validate if a number satisfies conditions
validate_conditions <- function(x, y, z) {
  return(y + z == 5 && (100*x + 10*y + z) - (100*z + 10*y + x) == 792)
}

# Initialize an empty vector to store potential solutions
potential_numbers <- c()

# Iterate through possible values for x, y, and z
for (x in 0:9) {
  for (y in 0:9) {
    for (z in 0:9) {
      # Check if the current combination meets conditions
      if (validate_conditions(x, y, z)) {
        # If conditions are met, store the three-digit number
        potential_numbers <- c(potential_numbers, 100*x + 10*y + z)
      }
    }
  }
}

# Output the potential solutions
cat("Identified three-digit numbers based on the specified conditions:", paste(potential_numbers, collapse = ", "), "\n")
## Identified three-digit numbers based on the specified conditions: 850, 941