Prime decomposition over the real numbers?

You are trying to prove that the reals are a UFD, up to units. That is true, but not in the way you would like. Since $\mathbb{R}$ is a field, every nonzero element is a unit (not just $\pm 1$). Hence, you need to expand the exception to include everything, which alas trivializes the result.

As desired, here's a further explanation. Suppose you had such a unique factorization $x=x_1^{p_1}\cdots x_n^{p_n}$, with $p_i\in\mathbb{N}$. But then you'd also need one for $\frac{1}{x}$, and by uniqueness you would need $\frac{1}{x}=x_1^{-p_1}\cdots x_n^{-p_n}$; but now the exponents are no longer positive.


The prime factorization of an integer represents a pairing function. If we consider the prime factorization of an integer $n = p_1^{k_1} *  p_2^{k_2} *  p_3^{k_3} ..... *  p_m^{k_m} $

Then we can form a pairing function where $P(n)=\left< k_1,k_2,....k_m \right>$

Some values of $P(N)$:

\begin{align} P(1) &= \left<0,0\right>\\ P(2) &= \left<1,0\right>\\ P(3) &= \left<0,1\right>\\ P(4) &= \left<2,0\right>\\ P(5) &= \left<0,0,1\right>\\ \end{align}

Since the values of $PP$ are points in multidimensional space, we can connect these points and then get a unique canonical factorization of all reals.

The convex hull is convenient for this.

Say $P(n)=\left< k_1,k_2,....k_m \right>$ and $P(n+1)=\left< j_1,j_2,....j_m \right>$

The convex hull is equal to $(x) * P(n) + (1-x) * P(n+1) $ for $ 0 \leq x \leq 1.0 $ and will give us all points in the line from $P(n)$ to $P(n+1)$

Consider the inverse function: $P^{-1}(\left< k_1,k_2,....k_m \right>) = p_1^{k_1} *  p_2^{k_2} *  p_3^{k_3} ..... *  p_m^{k_m} $

It is clearly continuous, as exponentiation is a continuous function. This means that taking the inverse of the convex hull will give us a unique canonical factorization for all reals between n and n+1.

Consider all reals between 3 and 4.

Let us look at plot of $P^{-1}((x)*P(3) + (1-x)*P(4))$ for $x \in [0,1]$

plot of P inverse

Perfect, we capture all the reals like we desired.

Let us finalize our solution.

Given a positive real number $r$ (including naturals), we must solve this equation in order to get the unique canonical prime factorization that corresponds to it:

$r = P^{-1}((x)*P(\lfloor r \rfloor) + (1-x)*P(\lfloor r \rfloor + 1))$ for $x \in [0,1]$

We can simplify the equation and solve it in the general case.

Let $u = P(\lfloor r \rfloor),\ v = P(\lfloor r \rfloor + 1) $

Then $ \displaystyle r = \prod\limits_{n} p_n^{(1-x) * u_n + (x) * v_n} $

Since $p^k = e^{Log(p) * k}$ , we can rewrite the right hand side as a natural exponentiation so all powers will add.

$ \begin{align} \displaystyle r &= e^{(\sum\limits_{n} (1-x) * Log(p_n) * u_n + (x) * Log(p_n) * v_n)} \cr Log(r) &= {\sum\limits_{n} (1-x) * Log(p_n) * u_n + (x) * Log(p_n) * v_n} \cr Log(r) &= x {\sum\limits_{n} Log(p_n) * v_n - Log(p_n) * u_n} + {\sum\limits_{n} Log(p_n) * u_n} \cr x &= \dfrac{(Log(r)-{\sum\limits_{n} Log(p_n) * u_n})}{\sum\limits_{n} Log(p_n) * v_n - Log(p_n) * u_n} \cr \end{align} $

Here are some neat examples of the factorization:

In[383]:= CanonicalRealFactorization[$\Pi$]

Out[383]= $\left<2\to \frac{2 (\log (\pi )-\log (3))}{2 \log (2)-\log (3)},3\to 1-\frac{\log (\pi )-\log (3)}{2 \log (2)-\log (3)}\right>$

In[384]:= CanonicalRealFactorization[$e$]

Out[384]= $\left<2\to 1-\frac{1-\log (2)}{\log (3)-\log (2)},3\to \frac{1-\log (2)}{\log (3)-\log (2)}\right>$

In[388]:= CanonicalRealFactorization[$e^{10}$]

Out[388]= $$ \begin{align} \displaystyle &\left< 2\to 1-\frac{10-\log (2)-\log (3)-\log (3671)}{-\log (2)-\log (3)-\log (3671)+\log (22027)}, \right. \cr &\left.3\to 1-\frac{10-\log (2)-\log (3)-\log (3671)}{-\log (2)-\log (3)-\log (3671)+\log (22027)}, \right. \cr &\left.3671\to 1-\frac{10-\log (2)-\log (3)-\log (3671)}{-\log (2)-\log (3)-\log (3671)+\log (22027)}, \right. \cr &\left.22027 \to \frac{10-\log (2)-\log (3)-\log (3671)}{-\log (2)-\log (3)-\log (3671)+\log (22027)} \right> \end{align} $$

In[385]:= CanonicalRealFactorization[$\phi$]

Out[385]= $\left<1\to 1-\frac{\log (\phi )}{\log (2)},2\to \frac{\log (\phi )}{\log (2)}\right>$

I've included Mathematica code for the plot, as well as the canonical factorization.

CanonicalRealFactorizationPlot[r_] := Block[{
    p1 = FactorInteger@Floor@r,
    p2 = FactorInteger@Floor[r + 1],
    f1, f2
    },
   f1 = Product[p[[1]]^(p[[2]]*(1 - x)), {p, p1}];
   f2 = Product[p[[1]]^(p[[2]]*(x)), {p, p2}];
   (* plot convex hull of two points *)
   Plot[f1*f2, {x, 0, 1}]
   ];

CanonicalRealFactorization[r_] := Block[{
    p1 = <|Rule @@@ FactorInteger@Floor@r|>,
    p2 = <|Rule @@@ FactorInteger@Floor[r + 1]|>,
    c, d, x
    },
   c = Plus @@ KeyValueMap[Log[#1]*#2 &, p1];
   d = Plus @@ KeyValueMap[Log[#1]*#2 &, p2];
   x = (Log[r] - c)/(d - c);
   Merge[{(1 - x)*p1, (x)*p2}, Total]
   ];

Example usage:

In[332]:= CanonicalRealFactorizationPlot[3.4]

Out[332]= (*Plot Graphic*)

In[333]:= CanonicalRealFactorization[3.4]

Out[333]= <|3 -> 0.564925, 2 -> 0.870149|>

In[334]:= 2^0.8701490634247632`*3^0.5649254682876184`

Out[334]= 3.4

Below is a quick visualization of the 2d factorization point space for the interval [1,4] (because the point space becomes 3d at 5.)

pts = Table[
   Lookup[CanonicalRealFactorization[r], {2, 3}, 0]
   , {r, 1, 4, 0.01}];
ListPlot@pts

point space for interval (1,4)