wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> microsoft >> MS question 3
(Message started by: kiki lee on Jun 25th, 2003, 1:36pm)

Title: MS question 3
Post by kiki lee on Jun 25th, 2003, 1:36pm
Generate a 9 digit number using the number 1-9, without using any number
more than once.  this number must also be divisible such that if you take
the left most digit the number is divisible by 1, if you take the two  
left most digits the number is divisible by 2, if you take the three left
most digits the number is divisible by 3, etc., etc.  What is the number?

Title: Re: MS question 3
Post by Ozzie on Jun 26th, 2003, 11:16am
Can you please clarify what you mean by take the left n digits ?  Does that mean, for example, that if you are taking 3 left digits, that you are trying to make the 3 digits divisible by 3 or the remaining 6 digit number divisible by 3 ?

Title: Re: MS question 3
Post by towr on Jun 26th, 2003, 11:49am
I think she means you have number a,b,c,d,e,f,g,h,i that together are the numbers 1-9
and
i % 1 = 0  (% = modulus)
hi % 2 = 0
ghi % 3 = 0
fghi % 4 = 0
efghi % 5 = 0
defghi % 6 = 0
cdefghi % 7 = 0
bcdefghi % 8 = 0
abcdeghi % 9 = 0

I think it's also allready on the site..
In any case it's easy to brute-force it with a simple program (trying every combination)

Title: Re: MS question 3
Post by wowbagger on Jun 26th, 2003, 11:54am
I almost agree with you, towr.
You do know left from right, don't you?  ;)

Maybe someone like BNC will come up with a non-brute force answer.

Title: Re: MS question 3
Post by BNC on Jun 26th, 2003, 11:54am

on 06/26/03 at 11:49:54, towr wrote:
I think it's also allready on the site..


here (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi?board=riddles_medium;action=display;num=1045142771;start=0)

Title: Re: MS question 3
Post by towr on Jun 27th, 2003, 1:11am

on 06/26/03 at 11:54:29, wowbagger wrote:
I almost agree with you, towr.
You do know left from right, don't you?  ;)

Not usually.. why? ;D

heh, I did get it right in the other thread :P

Title: Re: MS question 3
Post by Claire Main on Aug 28th, 2004, 4:22pm
Actually the question is slightly different...this question asks for a 9 digit number using the digits 1-9, the other asks for a 10-digit number using 0-9 :)

Title: Re: MS question 3
Post by Icarus on Sep 17th, 2004, 7:12pm
True - but if you can find the answer for one, the other is fairly obvious, isn't it? :)

Title: Re: MS question 3
Post by Grimbal on Sep 18th, 2004, 11:19am
We can rephrase the conditions
(note a|b means a divides b i.e. b = a*n)
1.  always true
2.  2|b
3.  3|a+b+c
4.  4|cd
5.  e = 5, and no other digit if 5
6.  2|f and 3|d+e+f
7.  7|abcdefg
8.  8|gh  (8|fgh, but f is even)
9.  always true if all digits are used

- b,d,f,h are even, so a,c,e,g,i are odd.
- d+e+f must be an odd multiple of 3 with e=5.  Only 258, 456, 654 and 852 are possible for def.
- 4|cd, and c odd implies d is 2 or 6.  def = 258 or 654.

- a+b+c and g+h+i are even and multiples of 3.

- 8|gh and g odd implies g is 2 or 6.  gh = 16, 32, 72, 96.  (56 uses 5).
- 6|g+h+i, implies ghi is one of 321, 327, 723, 729, 963.
- the only possible def are resp. 654, 654, 654, 654, 258.
- the only possible abc or cba are 789, 189, 189, 183, 147.

This leaves only the following numbers
789654321
987654321
189654327
981654327
189654723
981654723
183654729
381654729
741258963
147258963
they all satisfy all divisibilities except by 7.

Only 381654729 satisfies the divisibility by 7.

Title: Re: MS question 3
Post by coolnfundu on Oct 18th, 2004, 3:55am
it does not obey the second condition of divisibility by two

Title: Re: MS question 3
Post by Grimbal on Oct 19th, 2004, 9:45am
The original riddle asked about the n left-most digits to be divisible by n.  So, it should read:

a % 1 = 0  (% = modulus)
ab % 2 = 0
abc % 3 = 0
abcd % 4 = 0
abcde % 5 = 0
abcdef % 6 = 0
abcdefg % 7 = 0  
abcdefgh % 8 = 0
abcdefghi % 9 = 0

And 78 is divisible by 2.

Title: Re: MS question 3
Post by vijendhar on May 2nd, 2008, 11:00pm
What is the algo for this

Title: Re: MS question 3
Post by softsec on Jan 27th, 2013, 2:21am
brootforced?



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board