division by 7 efficiently
- From: krypto.wizard@xxxxxxxxx
- Date: 31 Jan 2007 22:02:48 -0800
Last month I appeared for an interview with EA sports and they asked
me this question.
How would you divide a number by 7 without using division operator ?
I did by doing a subtraction and keeping a counter that kept a tab on
how many times I subtracted.
Later, the EA sport guy told me that of course there are can be better
technique by using bit operator.
Since 7 has a binary representation 111, my guess is that a left shift
operation of 3 bits should give the answer, but I couldn't get it to
work.
Any comments ?
.
- Follow-Ups:
- Re: division by 7 efficiently
- From: Alan Morgan
- Re: division by 7 efficiently
- From: Roger Willcocks
- Re: division by 7 efficiently
- From: W Karas
- Re: division by 7 efficiently
- From: W Karas
- Re: division by 7 efficiently
- From: Richard Harter
- Re: division by 7 efficiently
- From: Logan Shaw
- Re: division by 7 efficiently
- From: Richard Heathfield
- Re: division by 7 efficiently
- From: Arthur J. O'Dwyer
- Re: division by 7 efficiently
- Prev by Date: Re: Enigma cipher program
- Next by Date: Re: division by 7 efficiently
- Previous by thread: Enigma cipher program
- Next by thread: Re: division by 7 efficiently
- Index(es):
Relevant Pages
|