On Feb 1, 2:36 pm, John Nagle <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Its not an homework. I appeared for EA sports interview last month. I > > was asked this question and I got it wrong. I have already fidlled > > around with the answer but I don't know the correct reasoning behind > > it. > > The answer to that question is that the fastest way to divide > by 7 is to use the divide instruction. You'd have to go down > to a really old 8-bit microprocessor like the Intel 8051 to > find something where bit-twiddling like that pays off.
Perhaps not that far back. Google "Granlund Montgomery". The technique got built into gcc. > And no way would this be a win in Python, which is > interpreted. Agreed. -- http://mail.python.org/mailman/listinfo/python-list