【问题标题】:From 1 to N how many pairs have LCM = N?从 1 到 N 有多少对 LCM = N?
【发布时间】:2016-09-18 13:23:38
【问题描述】:

假设 N = 8。有 4 对 (1,8),(2,8),(4,8),(8,8),其 LCM 为 8。如果 N = 6。则有 5 对(1,6),(2,6),(2,3),(3,6),(6,6) 其LCM为6。现在想知道如何快速找到对数?

【问题讨论】:

  • 你的 SHIFT 键卡住了

标签: algorithm number-theory lcm


【解决方案1】:

math.stackexchange.com 上的问题"Pairs of numbers with at given LCM" 给出了公式

((2e1+1)(2e2+1)...(2ek+1)+1)/2
        where e1, e2, ... is the exponents for the unique prime factors of n

这个号码。


8 = 2^3 有 ((2*3+1)+1)/2 = 4 个这样的对,
6 = 2^1 * 3^1 有 ((2*1+1)(2*1+1)+1)/2 = 5 个这样的对,并且
60 = 2^2 * 3^1 * 5^1 有 ((2*2+1)(2*1+1)(2*1+1)+1)/2 = 23 个这样的对。

【讨论】:

    【解决方案2】:

    您可以在这里参考类似的问题
    https://math.stackexchange.com/questions/4152/pairs-of-numbers-with-a-given-lcm
    基本上如果 n=(p1^e1)(p2^e2)...(pk^ek) 其中 pi 是 1 的素数 那么解决方案将是 ((2e1+1)(2e2+1)...(2ek+1)+1)/2

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-11
      • 1970-01-01
      相关资源
      最近更新 更多