1 2 3 4 5 6 7 8 9
int y(x, buckets) { int result = 0; while ( x != 0 ){ // Multiply the first and last digits of x and add it to result. result += last_digit(x) * first_digit(x) x = remove_first_and_last_digit(x) } return (result mod buckets) }