[Question]
  [
In [this challenge](https://codegolf.stackexchange.com/q/139034/56656) we learned a way to encode every positive integer using factor trees.
Here is how it works:
* The empty string has value of 1.
* `(S)` where `S` is any expression with a value of **S** evaluates to the **S**th prime.
* `AB` where `A` and `B` are arbirary expressions with values of **A** and **B** respectively has value **A\*B**.
For example if we wanted to represent 7 we would do
```
  7 -> (4) -> (2*2) -> ((1)(1)) -> (()())
```
Turns out we can represent every whole number using this method. In fact some numbers we can represent in multiple ways. Because multiplication is commutative 10 is both
```
((()))()
```
and
```
()((()))
```
At the same time some numbers can only be represented in 1 way. Take 8 for example. 8 can only be represented as
```
()()()
```
And since all of our atoms are the same we can't use commutivity to reorganize them.
---
So now the question is "Which numbers can only be represented in 1 way?". The first observation is one I just started making back there. It seems that perfect powers have some special properties. Under further investigation we can find 36, which is 62 is a perfect power but has multiple representations.
```
(())()(())()
(())()()(())
()(())()(())
()(())(())()
()()(())(())
```
And this makes sense because 6 is already rearrangable, so any number we make out of 6 must also be rearrangable.
So now we have a rule:
* A number has a unique representation if it is a perfect power of a number with a unique representation.
That rule can help us reduce determining if a composite number is unique to determining if a prime number is unique. Now that we have that rule we want to figure out what makes a *prime* number unique. This is actually pretty self evident. If we take a unique number and wrap it in parentheses, the result must be unique, and, going the other way if **n** has multiple representations the **n**th prime must have multiple representations. This yields the second rule:
* The **n**th prime is unique if and only if **n** is unique.
Both of these rules are recursive, so we are going to need a base case. What is the smallest unique number? One might be tempted to say 2 because its just `()`, but 1, the empty string, is even smaller and is unique.
* 1 is unique.
With these three rules we can determine whether a number has a unique factor tree.
## Task
You may have seen it coming, but your task is to take a positive integer, and determine if it is unique. You should write either a program or function that does this computation. You should output one of two possible values, what these values are is up to you but one should represent "yes", being output when the input is unique and one should represent "no" being output otherwise.
Your answers should be scored in bytes with less bytes being better.
## Test cases
Here are the first couple unique numbers:
```
1
2
3
4
5
7
8
9
11
16
17
19
23
25
27
31
```
Suggested test cases
```
5381 -> Unique
```
It seems that [OEIS A214577](https://oeis.org/A214577) is somehow related, so if you need more test cases try there, but I don't know they are the same so use at your own risk.
  
[Answer]
# [Husk](https://github.com/barbuz/Husk), ~~11~~ 10 bytes
Saved one byte thanks to Zgarb!
```
Ωεo?oṗ←¬Ep
```
Returns `1` for unique, `0` otherwise
[Try it online!](https://tio.run/##AR4A4f9odXNr///Oqc61bz9v4bmX4oaQwqxFcP///zUzODE "Husk – Try It Online") Or [returning the first 50](https://tio.run/##ASQA2/9odXNr/yDihpE1MGbigoFO/86pzrVvP2/huZfihpDCrEVw//8)
### Explanation:
```
Ωε              Until the result is small (either 1 or 0), we repeat the following
         p     Get the prime factors
  o?           If ...
        E      they are all equal:
    ȯṗ←           Get the index of the first one into the primes
               Else:
       ¬          Not the list (since non-empty lists are truthy, this returns 0)
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 10 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
After a LOT of fiddling around!
```
ÆET0ṪḊ?µl¿
```
A monadic link taking a positive integer and returning `1` if it is unique or `0` if not.
**[Try it online!](https://tio.run/##ASQA2/9qZWxsef//w4ZFVDDhuarhuIo/wrVswr//MzEsw4ck4oKsR/8 "Jelly – Try It Online")**
### How?
```
ÆET0ṪḊ?µl¿ - Link: number, n     e.g. 11          or 13            or 20
         ¿ - while:
        l  - ...condition: (left) logarithm with base (right)
           -               note: x log 0 and x log 1 both yield None, which is falsey
       µ   - ...do the monadic chain: (first pass shown)
ÆE         -   prime exponent array   [0,0,0,0,1]    [0,0,0,0,0,1]    [2,0,1]
  T        -   truthy indexes         [5]            [6]              [1,3]
      ?    -   if:
     Ḋ     -   ...condition: dequeue (i.e. if length > 1)
   0       -   ...then: literal zero   -              -               0
    Ṫ      -   ...else: tail           5              6               -
           - end result                1              0               0
```
**Wait, logarithm, what?!**
Lets run through some examples of the loop.
If `n=31` (**311**, the eleventh prime):
```
log test # |  left, x |  right, b |  x log b
-----------+----------+-----------+----------
         1 |       31 |        31 |    1.000 -> continue
         2 |       11 |        31 |    0.698 -> continue
         3 |        5 |        11 |    0.671 -> continue
         4 |        3 |         5 |    0.683 -> continue
         5 |        2 |         3 |    0.631 -> continue
         6 |        1 |         2 |    0.000 -> stop, yielding left = 1
```
If `n=625` (**54**):
```
log test # |  left, x |  right, b |  x log b
-----------+----------+-----------+----------
         1 |      625 |       625 |    1.000 -> continue
         2 |        3 |       625 |    0.171 -> continue
         3 |        2 |         3 |    0.631 -> continue
         4 |        1 |         2 |    0.000 -> stop, yielding left = 1
```
If `n=225` (**52×32**):
```
log test # |  left, x |  right, b |  x log b
-----------+----------+-----------+----------
         1 |      225 |       225 |    1.000 -> continue
         2 |     *  0 |       225 |-inf+nanj -> continue
         3 |     ** 0 |         0 |     None -> stop, yielding left = 0
*The dequeued list was not empty
**Tailing an empty list in Jelly yields 0
```
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), 42 bytes
```
⎕CY'dfns'
{1≥⍵:1⋄1=≢∪r←3pco⍵:∇1+¯1pco⊃r⋄0}
```
Using `⎕CY'dfns'` with `dfns`es isn't very feasible on tio.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 11 bytes
```
ÆfẋE$ḢÆCµl¿
```
[Try it online!](https://tio.run/##ASYA2f9qZWxsef//w4Zm4bqLRSThuKLDhkPCtWzCv/8zMSzDhyTigqxH/w "Jelly – Try It Online")
-2 thanks to a very genius trick by [Jonathan Allan](https://codegolf.stackexchange.com/users/53748/jonathan-allan).
Using H.PWiz's Husk algorithm.
[Answer]
# [Pari/GP](http://pari.math.u-bordeaux.fr/), 49 bytes
```
f(n)=d=factor(n);n<2||(#d~<2&&f(primepi(d[1,1])))
```
[Try it online!](https://tio.run/##JYpBCoAgEADvfSOIXbBAJQjSl4iHyDb2kIl0lL5uQrdhZtKWeTxTrQQRbbC07c@dG6/RqFKgD69Rw0CQMl9HYghOCukRsTYTH3Bc2IxOTpNWXhAweuz@RDDrRbbzAw "Pari/GP – Try It Online")
]