[net.math] 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

keith@seismo.UUCP (Keith Bostic) (08/19/84)

Bill, I think you're looking at this the wrong way:
======================================================================
tmp<159> @ c = 9
tmp<160> while 1
? 	if ($c % 10 == 9 && $c % 9 == 8 && $c % 8 == 7 && $c % 7 == 6 && \
? 		$c % 6 == 5 && $c % 5 == 4 && $c % 4 == 3 && $c % 3 == 2 && \
? 		$c % 2 == 1) then
? 			echo "it's $c"
? 			break
? 	else @ c += 10
? 	endif
? end
it's 2519
tmp<161>

See what I mean?
		Keith 
			ARPA: keith@seismo 
			UUCP: seismo!keith

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.

eklhad@ihnet.UUCP (K. A. Dahlke) (08/20/84)

The cheap way.

main(){
register i,j;
for(i=1;;++i){
for(j=2;j<11;++j) if(i%j!=j-1) break;
if(j==11){ printf("%d\n",i); exit(0); }
}
}

If you are not into computers, try the chinese remainder theorem.
x%5=4 x%7=6 x%8=7 x%9=8
bc(1) or a calculator makes short work of this.
-- 

Karl Dahlke    ihnp4!ihnet!eklhad

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