[net.puzzles] a hard one!?!?

set@bnl.UUCP (William Tatum) (08/18/84)

[the wiser of the wisemen will know the answer]



here is a problem that gave me a little trouble.here it is for your enjoyment:

 what is the smallest whole number that,when divided by two leaves a remainder of 1;when divided by three leaves the remainder of two;and so on,and when divided by 10 leaves a remainder of nine?????



comments?     
                  set

mwg@mouton.UUCP (08/20/84)

++
Problem:	Find N s.t.  N/m yields a remainder
		of m-1 for All m in [2,10].

Solution:	N+1 must be a multiple of all integers in [2..10],
		so N+1 = 2*2*2*3*3*5*7  ->  N = 2519.

mr@hou2h.UUCP (M.RINDSBERG) (08/21/84)

Here is a small program to find the number. Hard one ????????

#define	MAXNUM	10000
main()
{
	char a[MAXNUM];
	int i, j;

	for(i = 0; i < MAXNUM; i++)
		a[i] = 0;
	for(j = 2; j <= 10; j++){
		for(i = 0; i < MAXNUM; i++)
			if( i % j != j - 1)
				a[i] = 1;
	}
	for(i = 0; i < MAXNUM; i++)
		if(a[i] == 0){
			printf("Number is %d\n",i);
			exit(0);
		}
}

gary@mit-eddie.UUCP (Gary Samad) (09/01/84)

><

Oops.  Mine was an obvious correct answer but I didn't notice that
the smallest was required.

	Gary Samad