0

How can I get the prime factors of a (non-prime) number, with all the primes being less than a factor base B.

For example if B=8, then the primes used can only be in {2,3,5,7}. And given 48, it returns 2^4 * 3.

Anyone know how to do this in wolfram alpha?

Thanks

omega
  • 40,311
  • 81
  • 251
  • 474

2 Answers2

0

You can't.

The prime factors of a number are a property of the number itself, not its representation in any particular base. As a simple example, there is no prime factor of 11 that is less than 8.

Simon Byrne
  • 7,694
  • 1
  • 26
  • 50
  • My question is for given numbers that are not prime, get the prime factorization. And then if there is no prime factorization with primes less then B, it should say no solution. – omega Dec 12 '14 at 20:17
  • It seems the factor base is irrelevant, cause there is only 1 way to represent a prime factorization. Then you can do the rest by doing `prime factorization of 48`. – omega Dec 12 '14 at 20:31
0

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.