Divided by 7 or 6, the remainder is 1. What are the maximum four digits and the minimum four digits?

Divided by 7 or 6, the remainder is 1. What are the maximum four digits and the minimum four digits?

7x6 = 42, that is, the four digit number is divided by 42, and the remainder is 1
The maximum is 42 * 238 + 1 = 9997, and the minimum is 42 * 24 + 1 = 1009