如何获得(非素数)数的素数,所有素数都小于因子基数 B。
例如,如果 B=8,则使用的素数只能在 {2,3,5,7} 中。给定 48,它返回 2^4 * 3。
任何人都知道如何在 wolfram alpha 中做到这一点?
谢谢
如何获得(非素数)数的素数,所有素数都小于因子基数 B。
例如,如果 B=8,则使用的素数只能在 {2,3,5,7} 中。给定 48,它返回 2^4 * 3。
任何人都知道如何在 wolfram alpha 中做到这一点?
谢谢
你不能。
数的质因数是数本身的属性,而不是它在任何特定基数中的表示。举个简单的例子,没有小于 8 的 11 的质因数。
Sorry, don't know anything about mathematica but here is an algorithm that works:
Divide the starting value, B, by 2 and check the remainder.
If remainder is zero, 2 was a factor. If not, try other primes, [3, 5, 7, ...] up to half of the starting value.
Repeat the process by dividing the starting value by whatever factor you just found and starting again with that.
If you are working with very large numbers then be careful with the precision of the division.