Algorithm for finding smallest number with given number of factors

前端 未结 2 1307
野趣味
野趣味 2020-12-31 07:30

What\'s the most efficient algorithm anyone can think of that, given a natural number n, returns the least natural number x with n positive diviso

2条回答
  •  失恋的感觉
    2020-12-31 07:56

    http://www.primepuzzles.net/problems/prob_019.htm

    b) Jud McCranie, T.W.A. Baumann & Enoch Haga sent basically the same procedure to find N(d) for a given d:

    1. Factorize d as a product of his prime divisors: d = p1a1 * p2a2 *p3a3 *...
    2. convert this factorization in another arithmetically equivalent factorization, composed of non-powered monotonically decreasing and not necesarilly prime factors... (uf!...) d = p1a1 * p2a2 *p3a3 *... = b1 * b2 * b3... such that b1 ≥ b2 ≥ b3...
      You must realize that for every given d, there are several arithmetically equivalent factorizations that can be done: by example:
      if d = 16 = 24 then there are 5 equivalent factorizations: d = 2*2*2*2 = 4*2*2 = 4*4 = 8*2 = 16
    3. N is the minimal number resulting of computing 2b1-1 * 3b2-1 * 5b3-1 * ... for all the equivalent factorizations of d. Working the same example:
      N(16) = the minimal of these {2 * 3 * 5 * 7, 23 * 3 * 5, 23 * 33, 27 * 3, 215} = 23 * 3 * 5 = 120

    Update: With numbers around 1020, pay attention to the notes by Christian Bau quoted on the same page.

提交回复
热议问题