Re: division by 7efficiently
- From: "eKo1" <berndlosert@xxxxxxxxxxxx>
- Date: 1 Feb 2007 16:19:38 -0800
On Feb 1, 2:28 pm, "Krypto" <krypto.wiz...@xxxxxxxxx> wrote:
The correct answer as told to me by a person is
(N>>3) + ((N-7*(N>>3))>>3)
The above term always gives division by 7
N >> 3 is the same as dividing the number by eight so you have that
(N>>3) + ((N-7*(N>>3))>>3) = N/8 + (N - 7(N/8))/8 = N/8 + N/8 - 7N/64
= 2N/8 - 7N/64 = (16N - 7N) / 64 = 9/64 N.
9/64 = 0.140625
1/7 = 0.14285714285714285...
Close, but no cigar.
.
- Follow-Ups:
- Re: division by 7efficiently
- From: Jón Fairbairn
- Re: division by 7efficiently
- From: Le Chaud Lapin
- Re: division by 7efficiently
- References:
- division by 7efficiently
- From: krypto . wizard
- Re: division by 7efficiently
- From: Tom Truscott
- Re: division by 7efficiently
- From: Krypto
- division by 7efficiently
- Prev by Date: Re: O(n) Parsing For General Context-Free Grammars & Transductions
- Next by Date: Re: Hofman and Diaby talk about P=NP at INFORMS 2007
- Previous by thread: Re: division by 7efficiently
- Next by thread: Re: division by 7efficiently
- Index(es):