Strange rounding problem
sjmachin at lexicon.net
Sun Mar 16 22:28:30 CET 2003
danb_83 at yahoo.com (Dan Bishop) wrote in message news:<ad052e5c.0303160138.5f2149aa at posting.google.com>...
> If we define the utility of a number base as proportional to the
> number of its factors (excluding itself), and inversely proportional
> to the magnitude of those factors (and use the Python script at the
> end of this message to calculate those factors), we find that the best
> bases are 12 (1.562), 6 (1.500), and 24 (1.361), and that bases 14,
> 21, 22, 25-28, and 32-35 are worse than the prime bases.
> def factors(n):
> # list of factors of n, including 1 and excluding n
> return [i for i in xrange(1, n // 2 + 1) if not n % i]
Wouldn't it be better to exclude non-prime factors of the base?
More information about the Python-list