一个数的质因数

4

以下是问题:

f(x)=sum of power of prime factor of x
now if f(x) is given then find the least value of x which also setisfy the condition
(No of divisor of x)-1=f(x).
Eg: f(x)=2 given and i need to find x 
Step 1:check for x=2 then f(x)=1
Step 2:check for x=3 then f(x)=1
Step 3: check for x=4 then f(x)=2 (i.e-x=2^2,and we know that f(x) is some of power of prime factor so f(x) here is 2)
And divisor of 4 is 1,2 & 4 so ,no of divisor -1=f(x)

so the Answer is x=4.

Now the approach i followed
Step 1-start for i=2 till we get the answer
step 2-find the prime factor for i and calculate the sum of power
Step 3-check if calculated sum is equal to the f(x) or not if not then increment i and repeat from step -1.

我的问题是:

  1. 我从i=2开始,每次增加1,检查f(x)。有没有更有效的方法?
    1. 我会一直循环直到得到答案。是否可以通过其他结束条件来完成,因为可能会进入无限循环?请帮忙。

1
如果 f(x)=y,那么最小的解难道不总是 2^y 吗? - Henry
@Henry 抱歉,我错过了另一个条件,现在已经添加了。感谢你的关注。 - Vksgh
1
第二个条件不会改变任何事情,因为2的y次方有y+1个约数。 - Henry
1个回答

4
每个数字都可以表示为:
x = a1p1.a1p1...anpn 其中:
ai 1 <= i <= n 是质因数。
因此,为了使x最小化,所有因子都应为2,因此x将为2 ^ f(x)。
x的约数个数为:(p1 + 1)(p2 + 1)...(pn + 1),所以您添加的条件也将得到满足!

非常非常抱歉,我错过了一个条件(x的除数数量)-1 = f(x)。现在我已经添加了。感谢您的关注。 - Vksgh
1
愉快编码 :) - Masked Man
我同意,但我不明白你是如何发现这就是 OP 所询问的内容... - xenteros
@xenteros,是的,这个问题一开始看起来有点神秘!:) - Masked Man

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接