Human Being, Occasional Smart Person, Just Some Guy

Fun With Math: A Natural Number is a Multiset of Prime Factors

A rule known as the fundamental theorem of arithmetic states, in so many words, that any natural number is uniquely representable as a multiset of prime factors, and vice versa. Having two operands in this form makes some operations easier and other ones more difficult.

prime number : A natural number with exactly two distinct natural factors, 1 and itself. In particular, 2 satisfies this requirement despite being even, while 1 does not satisfy this requirement because it has only one such factor instead of the required two.

multiset : A generalization of a set wherein the multiplicity of each item is significant.

The natural number indicated by a given multiset is the product of 1 and each element of the multiset. For example, 1 is represented by the empty multiset {∅}, 3 by {3}, 5 by {5}, 15 by {3,5}, 25 by {5,5}, and so on.

Multiset operations on the multisets correspond to other operations on the natural numbers they represent:

Intersection (i.e. retaining the lesser multiplicity per element) is equivalent to finding the greatest common divisor (gcd):

gcd(54, 24)

{2, 3, 3, 3} ⋂ {2, 2, 2, 3}

{2, 3}

6

Union (i.e. retaining the greater multiplicity per element) is equivalent to finding the least common multiple (lcm):

lcm(8, 12)

{2, 2, 2} ∪ {2, 2, 3}

{2, 2, 2, 3}

24

Addition of the multiset (i.e. retaining the sum of multiplicities per element) is equivalent to multiplication:

414 * 555

{2, 3, 3, 23} + {3, 5, 37}

{2, 3, 3, 3, 5, 23, 37}

229770

Subtraction of the multiset (i.e. retaining the differences of multiplicities per element between one set and another) is equivalent to division:

88088 / 2002

{2, 2, 2, 7, 11, 11, 13} − {2, 7, 11, 13}

{2, 2, 11}

44

Note that this division is not closed on natural numbers unless the result would also be a natural number (i.e. the left operand must be divisible by the right) because the multiset subtraction itself is not closed on multisets (with nonnegative multiplicities). The multiset notation can still help to reduce the fraction to lowest terms: