1

TL;DR: If X is a number that is created by multiplying n unique primes together, is it unique among all similarly created numbers?

My motivation for this is:

Let's say I have an array of 20,000 unique strings ordered alphabetically (not important here) and to each I assign, in ascending order, the ith prime from a corresponding list of the first 20,000 primes. Thus, the first item in the list is 2, the second 3, third 5, etc.

I am inclined to think of the prime as a symbol that represents the unique string.

Overall, I want to identify clusters of these reassigned symbols that reappear in lines of variable numbers of the symbols associated together uniquely (same symbol doesn't appear twice on a single line).

IOW, given the following mapping of unique strings to prime numbers:

"Unique-1" - 2
"Unique-2" - 3
"Unique-3" - 5
"Unique-4" - 7
"Unique-5" - 11

The two lines of associations of strings:

1)   Unique-1;Unique-2;Unique-3;Unique-4
2)   Unique-1;Unique-3;Unique-5;

Get transformed into:

1)   2;3;5;7
2)   2;5;11

The 2;5 is an n-cluster (n > 1) that appears more than once in this small data set.

2*5 = 10.

There are no n primes, other than 2,5, such that their product equals 10.

Can I use 10 as a unique identifier for the cluster 2;5, or, Unique-1;Unique-3.

IOW, can I confidently use any number so composed as a key in a dictionary data structure?

argyle
  • 113

1 Answers1

1

Yes, the uniqueness of prime factorization for a given integer is a basic theorem of number theory. You can find it in any textbook or online.

Here's a link:

https://en.wikipedia.org/wiki/Fundamental_theorem_of_arithmetic

victoria
  • 1,399
  • 6
  • 12