Re: A difficult problem
- To: mathgroup at smc.vnet.net
- Subject: [mg40307] Re: A difficult problem
- From: "Bill Bertram" <wkb at ansto.gov.au>
- Date: Sun, 30 Mar 2003 20:15:08 -0500 (EST)
- Organization: Australian Nuclear Science and Technology Organisation
- References: <b66cuo$ftd$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"Billy Yeung" <eg_ysyaa at stu.ust.hk> wrote in message news:b66cuo$ftd$1 at smc.vnet.net... > I have a difficult problem: > Given a constant integer X (which may be very large) , you no need to find the value of X > and > X mod 8 = n1 > X mod 16 = n2 > the problem is that find n2 if n1 is know? Not so difficult! Suppose you write X = 8 i + (Xmod 8) and X = 16 j + (Xmod 16) then, j = i/2 + (n1 - n2)/16. Since 0 <= n1 < 8, 0 <= n2 < 16 and j must be an integer, it is easily shown that for i even, n2 = n1. Whilst for i odd, n2 = n1+8. Cheers, Bill