Let n be the number, then:
n=3a+1=5b+3=7c+5=9d+7, where a, b, c, d are whole numbers.
So, 3a+1=5b+3, 3a=5b+2, a=(5b+2)/3;
5b+3=7c+5, 5b=7c+2;
7c+5=9d+7, 7c=9d+2.
In a=(5b+2)/3, substitute for 5b:
a=(7c+4)/3;
Now substitute for 7c:
a=(9d+6)/3=3d+2. Now we have a in terms of d.
5b=7c+2=9d+4,
so b=(9d+4)/5=(5d+4d+4)/5,
b=d+4(d+1)/5;
7c=7d+2d+2, c=d+2(d+1)/7.
We now have a, b, c in terms of d.
For b and c to be integers, 4(d+1)/5 and 2(d+1)/7 must be integers, so both 5 and 7 must divide into d+1. We know 5 and 7 both divide into 35 and all multiples thereof. So d+1=35m where m is an integer multiplier.
Therefore d=35m-1.
The smallest d is when m=1, d=34.
For now, let’s see what a, b and c are:
a=3d+2=104; b=d+28=62; c=d+10=44.
This makes n=3a+1=313=5b+3=7c+5=9d+7.
If we made m=2, d=69, and n=628, and so on for other values of m.
That’s an example of how this works, but we want the largest n, which we’ll call N. We know a=3d+2 and 3a+1=N<10000, so, substituting for a, 3(3d+2)<10000, 9d+6<10000, 9d<9994, d<9994/9, d<1110.4. But d=35m-1, so 35m-1<1110.4, 35m<1111.4, m<31.75, so max m=31, max d=1084, max a=3254, N=3a+1=9763.
CHECK:
9763/3=3254rem1; 9763/5=1952rem3; 9763/7=1394rem5; 9763/9=1084rem7.