So if you subtract one, it can be divisible by 2, 3, 4, 5 and 6.
The least common multiple of 2, 3, 4, 5 and 6 is 60.
So the number is 60a+ 1.
Divisible by 7.
60a+ 1=7n
n =(60a+ 1)/7 = 8a+(4a+ 1)/7
Order (4a+ 1)/7=b
Then 4a+ 1=7b.
a =(7 B- 1)/4 = b+(3 B- 1)/4
Order c=(3b- 1)/4
4c=3b- 1
b =(4c+ 1)/3 = c+(c+ 1)/3
So if c is divided by 3, the remainder is 2.
So c=3m+2.
b=4m+3
a=7m+5
n=(60a+ 1)/7=60m+43
60a+ 1=7n=420m+30 1
So there are countless solutions.
M=0 is the minimum value, with 420×0+30 1=30 1.