What is the least positive integer which when divided by 5 gives a remainder of 4, when divided by 6 gives a remainder of 5, when divided by 7 gives a remainder of 0, when divided by 8 gives a remainder of 1, when divided by 9 gives a remainder of 2, and when divided by 10 gives a remainder of 9?
Using CRT + MMI
i=0;j=0;m=0;t=0;a=( 7,8, 9, 5);r= ( 0, 1, 2, 9);c=lcm(a); d=c / a[i];n=d % a[i] ;loop1:m++; if(n*m % a[i] ==1, goto loop, goto loop1);loop:s=(c/a[i]*r[j]*m);i++;j++;t=t+s;m=0;if(i< count a, goto4,m=m);printc,"m + ",t % c;return
N =2520m + 2009, where m =0, 1, 2, 3........etc.
When m=0, then the smallest N that satisfies all 6 congruences ==2009