Operations with Prime Factorization
In a previous post I discussed the advantages and disadvantages of using decimal notation when performing certain operations on numbers. Let's look at four operations and at how well decimal notation and prime factorization do with them.
The operations will be: addition, multiplication, maximum, and least common multiple.
I left off subtraction, division, minimum, and greatest common multiple because they will behave similarly to their counterparts above. In case you are wondering, I take max(a, b) to be the largest of numbers a and b, and lcm(a, b) to be the least common multiple. Performing the "max" function can be equivalent to comparing the 2 numbers.
Here's how the notations pan out:
Addition - We have a simple alogithm for addition in decimal notation. In factorized notation, addition does not seem possible. The best way to add 2 numbers in factorized notation is to convert them to decimal notation.
Multiplication - In decimal notation, we have a good algorithm for it, but it is more complex than the addition algorithm. In factorized notation, it is very easy: just add the exponents.
24 x 50 = 1200
Maximum - This is easy in decimal notation. In factorized notation, comparisons don't seem possible. The best way to compare seems to be just to convert the numbers back into decimal.
Least Common Multiple - In decimal notation, this is tough, and it usually done through tables of multiples and searching for commonality. In most cases, we're bettor off converting to factorized notation first. In factorized notation, we get the least common multiple simply by taking the maximum of each exponent.
So of these four, we found two that work well with decimal notation (addition, maximum) and two that work well with factorized notation (multiplication, least common multiple).
There is an even deeper observation here. In factorized notation, the exponents are actually written in decimal. When we perform an operation on the exponents, this corresponds to a different operation on the factorized numbers.
For example, take addition, an operation that's easy to do on decimal numbers. When the exponents of a factorized number are added, we have performed a corresponding operation on the numbers themselves, in this case multiplication. In fact, many operations have this relationship. Here is a table of it:
operation performed on the exponents - operation performed on the factorized number
addition - multiplication
subtraction - division
maximum - least common multiple
minimum - greatest common factor
is x greater than y - is x divisible by y
is x less than y - does x divide y
Yes, to find the greatest common factor of two numbers, all you need to do is factorized, and take the minimum of the exponents. And to find out if one number divides another, check that all the exponents in the factorized form are smaller.
This is all nice to know, but the fact remains that doing place-value-easy operations on factorized numbers is a pain in the neck, and it's very difficult to prove any conjecture about them. A conjecture like - for example - the twin primes conjecture. Primes exist and manipulate in the factorized realm. The twin prime conjecture is asking when they differ by two, and subtraction is in the place-value realm.
Labels: algorithms, least common multiple, place value, prime factorization
