[Question]
  [
[Related](https://codegolf.stackexchange.com/questions/226292/g%C3%B6del-numbering-of-a-string) but different.
[Part II](https://codegolf.stackexchange.com/questions/260178/g%C3%B6del-encoding-part-ii-decoding)
Taken from the book: Marvin Minsky 1967 – Computation:  
Finite and Infinite Machines, chapter 14.
### Background
As the Gödel proved, it is possible to encode with *a unique positive integer* not just any string  
but any *list structure*, with any level of nesting.
Procedure of encoding \$G(x)\$ is defined inductively:
1. If \$x\$ is a number, \$G(x) = 2^x\$
2. If \$x\$ is a list \$[n\_0, n\_1, n\_2, n\_3, …]\$, \$G(x) = 3^{G(n\_0)} \cdot 5^{G(n\_1)} \cdot 7^{G(n\_2)} \cdot 11^{G(n\_3)} \cdot...\$  
Bases are *consecutive primes*.
### Examples:
`[0] → 3`
`[[0]] →` \$3^3 =\$ `27`
`[1, 2, 3] →` \$3^{2^1} \cdot 5^{2^2} \cdot 7^{2^3} = \$
`32427005625`
`[[0, 1], 1] →` \$3^{3^{2^0} \cdot 5^{2^1}} \cdot 5^{2^1} = \$
`15206669692833942727992099815471532675`
### Task
Create a program that encoding (in this way) any given (possibly ragged) list to integer number.  
This is `code-golf`, so the shortest code in bytes wins.
### Input
Valid non-empty list.  
**UPD**  
Some considerations regarding *empty lists* are given [here](https://codegolf.stackexchange.com/a/260088/114511).
You may assume:
* There are no empty sublists
* Structure is not broken (all parentheses are paired)
* List contains only non-negative integers
### Output
Positive integer obtained by the specified algorithm
### Note
Numbers can be very large, be careful! Your code *must be correct in principle*,
but it is acceptable that it cannot print some number.
However, all test cases are checked for TIO with Mathematica program and work correctly.
### Test cases
```
[0,0,0,0,0] → 15015
[1, 1, 1] → 11025
[[1], [1]] → 38443359375
[0, [[0]], 0] → 156462192535400390625
[[[0], 0], 0] → 128925668357571406980580744739545891609191243761536322527975268535
```
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~11 10 9~~ 8 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
-1 thanks to [Unrelated String](https://codegolf.stackexchange.com/users/85334/unrelated-string)! (Use of a dyadic chain in place of a monadic compound link avoiding the need for argument manipulation with ```.)
```
ß€Żð%¡ÆẸ
```
A monadic Link that accepts a ragged list of non-negative integers and yields its Gödel encoding.
**[Try it online!](https://tio.run/##y0rNyan8///w/EdNa47uPrxB9dDCw20Pd@34//9/dLSBjoJhLAgDAA "Jelly – Try It Online")** Or see the [test-suite](https://tio.run/##y0rNyan8///w/EdNa47uPrxB9dDCw20Pd@34f7gdKPL/f3S0QawOlwKIAtOGOgpGOgrGUDEdBcNYMIbIGMLY0SBhIAHmAFVBtCtAjQIZqQDFXLEA "Jelly – Try It Online").
### How?
```
ß€Żð%¡ÆẸ - Link: non-empty list OR number, X
     ¡   - repeat...
    %    -   ...number of times: (X) modulo (X)
                                 positive ints -> 0
                                 zero -> nan*
                                 non-empty lists -> non-empty lists*
                                 * truthy non-integers are treated by ¡ as 1
   ð     -   ...action: the dyadic chain - f(X, X):
 €       -              for each E in X:
ß        -                call this Link with X=E
  Ż      -              prefix with a zero (if X=zero we get [0])
     ÆẸ  - recompose from prime exponent list
              e.g.:
                    [0,4,0,2] -> 3^4 × 7^2 = 3969
                          [0] -> 2^0 = 1
                            n -> 2^n (non-list n treated as [n])
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 24 bytes
```
;2^₍|↰ᵐGl~lℕ₃ᵐṗᵐ≠≜;Gz^ᵐ×
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r/39oo7lFTb82jtg0Pt05wz6nLedQy9VFTM5DzcOd0IPmoc8GjzjnW7lVxQM7h6f//R0dHG8TqgNH/KAA "Brachylog – Try It Online")
Surely there are shorter ways to generate a list of primes…
Brachylog is based on SWI-Prolog and can deal with [arbitrarily large integers](https://tio.run/##SypKTM6ozMlPN/r/39oo7lFTb82jtg0Pt05wz6nLedQy9VFTM5DzcOd0IPmoc8GjzjnW7lVxQM7h6f//R0dHG8bqGIDQ/ygA), but this will quickly run out of memory for even simple lists.
### Explanation
```
;2^₍                       Output = 2^Input
    |                      Or (if the input is not an integer)
     ↰ᵐG                   Recursive call of this predicate for all elements of the Input; call the result G
       Gl~l                Take a list with as many elements as G
           ℕ₃ᵐṗᵐ≠≜         It must be a list of primes greater than 3 and all different (it always unifies with increasing magnitudes)
                   ;Gz     Zip with G
                      ^ᵐ   Map power
                        ×  Multiply
```
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), `A` ~~23~~ ~~21~~ 11 bytes
@AndrovT cool result:
```
Eλ-[żǎ$vxeΠ
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJBIiwiIiwiRc67LVvFvMeOJHZ4Zc6gIiwiIiwiWzEsIDEsIDFdXG5bWzFdLCBbMV1dXG5bMCwgW1swXV0sIDBdXG5bW1swXSwgMF0sIDBdIl0=)
Unfortunately, can't explain in detail.
Hope one of Vyxal' experts helps...
My old version, maybe useful for beginners in Vyxal:
```
ƛIȧ[:L›ÞpŻ$vx¨£e|E]fΠ
```
Every input must be list of lists, so first test case should be `[[1, 1, 1]]` etc.
-2 bytes thanks @emanresu (Vyxal chat)
```
ƛ                       #Begin lambda map 
 Iȧ                     #Condition for If: is it list?
     [                  #Begin If
      :L›               #If list - get length and add 1
         ÞpŻ            #Get slice of given length from infinite  list of primes
            $           #Swap
             vx         #Recursively apply to list
               ¨£e      #Zip and reduce pairs with exponentiation
                  |     #Else
                   E    #If number - two power
                    ]   #End If and lambda map,
                     fΠ #Flatten and reduce by product
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJBIiwiIiwixptJyKdbOkzigLrDnnDFuyR2eMKowqNlfEVdZs6gIiwiIiwiW1sxLCAxLCAxXV1cbltbWzFdLCBbMV1dXVxuW1swLCBbWzBdXSwgMF1dXG5bW1tbMF0sIDBdLCAwXV0iXQ==)
[Answer]
# [R](https://www.r-project.org), ~~103~~ ~~102~~ 98 bytes
*Edit: -1 byte, and then -4 more, both thanks to pajonk*
```
`?`=\(x,p=3)`if`(sum(!p%%1:p)>2,x?p+1,`if`(is.list(x),`if`(length(x),(x[-1]?p+1)*p^?el(x),1),2^x))
```
[Attempt This Online!](https://ato.pxeger.com/run?1=VY_RasIwFIbvfQplCDkzjpwTkzSDrpd9CJ2Ugc5CN8JaIe-ymyrsfXbr22iSSjdykfN_5-RL8n366s9l_nPs9svs8lYVVb5hnrtcQlXvK9YeP9jMzef47OCFuC_cAnns1O1TU7cd85Bys_t87w4hMr9e4muYhEe3LXZNgAicth5guOm3ZAKmD1OclAxDQbci-gQXEDtqJBiJGUnM8h7vLHrMH1Fag06MRuTEZXLQiowQSpP6bwsPxuEkCa211ZYyKe1tnoy1JKzNUK0MKknaqPSvvk_7FQ)
[Answer]
# JavaScript (ES13), 82 bytes
Expects a ragged list of Bigints. Returns a Bigint.
```
f=(a,k=2n,t=1n)=>a.at?a.map(a=v=>(g=d=>k%d--?g(d):d)(k++)?a(v):t*=k**f(v))&&t:k**a
```
[Attempt This Online!](https://ato.pxeger.com/run?1=bZJNTsMwEIUllqw4QjZUdn_tsWfsqeT2DmwRC4s0XaQkSIRehk0XcCg4DU6iVmoaSx558d43z6P5-q7qfHc6_Xw2xcL_PhVBxHkZoJo3QVcybOIyNtu4fIvvIoZj2Ih9yMOmfMwXi-1e5HKdS1HOZnIbxVGum2kop9MiPeVk0qzTO_bkv7uH17r6qA-75aHei0I8q-pFymx4VqvM3A-UrfRWm5TghlJdzbOUPTNX8BYKFpxSSIAj-Hmmq5euXFzJoxEUETExeGM4AcAxg2L2Gq3TaIDcDa6lXd8W2uGUvlHrrvd16765ViNRu5htHX7PW2sMshnP04_wnOXyPbIEmgENWqUMq7HhtM7OOHSDT04ib9Ch01YRe4VeOWudYbToWZNizRqscZSGRQYA0wQdAvnUs1-M8-r9Aw)
Or [79 bytes](https://ato.pxeger.com/run?1=m70kLz8ldcGCpaUlaboWN_3TbDUSdbJtjXRKbA01be0S9RJL7BP1chMLNBJty2ztNNJtU2ztslVTdHXt0zVSNK1SNDWytbU17RM1yjStSrRss7W00oBMzZoSKyAzEWrsnOT8vOL8nFS9nPx0jTSNaINYTU0FZKCvr2DMhaYIqApVGVCRkTm6KgMdBQQCqQeqMjQ1MDRFV2ioowBCCCNBCg0NjEwhboQFAQA) without Bigints.
[Answer]
# [Arturo](https://arturo-lang.io), 66 bytes
```
f:$[x][(block? x)?[p:3∏map x=>[p^f&until->prime? p->'p+2]]->2^x]
```
[Try it](http://arturo-lang.io/playground?bPDONo)
```
f:$[x][                       ; a function f taking an argument x
    (block? x)?[              ; is x a block? then...
        p:3                   ; assign 3 to p
        ∏                     ; product
        map x=>[              ; map over x, assign current elt to &
            p^f&              ; p raised to the Gödel encoding of the current elt
            until->prime? p-> ; until p is prime...
                'p+2          ; add 2 to p via in-place modification
        ]                     ; end map
    ]                         ; end the 'true' part of the ternary
    ->2^x                     ; ...otherwise, if x isn't a block, take 2^x
]                             ; end function
```
[Answer]
# [Python](https://www.python.org), 103 bytes
```
g=lambda n,k=1,m=1:m%k>n or-~g(n,k+1,m*k)
f=lambda l,p=3:l*0==0and 2**l or p**f(l[0])*f(l[1:]or 0,g(p))
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72soLIkIz9vwYKlpSVpuhY309NtcxJzk1ISFfJ0sm0NdXJtDa1yVbPt8hTyi3Tr0jWAotpAUa1sTa40mMocnQJbY6scLQNbW4PEvBQFIy2tHKByhQItrTSNnGiDWE0wbWgVCxQ00EnXKNDUhFrnXFCUmVeikaYBUqXJBecBuSh8Qx0jHWM0FTqGsUAEMwrmAwA)
Method for calculating next prime is shamelessly adapted from [Dennis's answer](https://codegolf.stackexchange.com/a/108539/113573).
[Answer]
# [PARI/GP](http://pari.math.u-bordeaux.fr/), 118 bytes
Modified from [@Dominic van Essen's answer](https://codegolf.stackexchange.com/a/260041/110802)
---
Golfed version, [try it online!](https://tio.run/##Vc7PTsMwDAbwO08xbUKKmSfFzpIsh3BBqG/ApfsjhMaUw0ZUuqkI8ezF0K4UOaefP31Ofq7S4pDbtlAN5mggfqZX9X4@qhQJM6p8myBGDfeMv5E5AUqi/sh71chmWu@eHh@mPzaT9VZCJW3grlCX/Uv9VokuCBM2ZZqLdwXyeNsAfLW5SqdaFUoDTNbrCd1cgTrgAUqNetOn7FipVz/W3swfifXI/l9pN0O1HrcTMpprFy/Za20d23Gr3B@@QJa1cy64wCtjguTZh8A6hBXZpSdr2HnbfgM)
```
G(x,p=3)={if(sum(i=1,p,(p%i)==0)>2,G(x,p+1),if(type(x)=="t_VEC",if(#x,p^G(x[1])*G(vector(#x-1,i,x[i+1]),p+1),1),2^x))}
```
Ungolfed version
```
G(x, p = 3) =
{
  if (sum(i = 1, p, (p % i) == 0) > 2,
    G(x, p + 1),
    if (type(x) == "t_VEC",
      if (#x,
        p^G(x[1]) * G(vector(#x - 1, i, x[i + 1]), p + 1),
        1
      ),
      2^x
    )
  )
}
print(G(0)) \\ 1
print(G(1)) \\ 2
print(G([0,0])) \\ 15
print(G([0,1])) \\ 75
print(G([0])) \\ 3
print(G([[0]])) \\ 27
print(G([0,0,0,0,0])) \\ 15015
print(G([1,2,3])) \\ 32427005625
print(G([[0,1],1])) \\ 15206669692833942727992099815471532675
```
[Answer]
# [Julia](https://julialang.org), ~~68~~ 66 bytes
```
!x::Int=2^x
!(x,p=2)=prod(i->(while(p+=1).%(2:p-1)∋0end;p^!i),x)
```
[Attempt This Online!](https://ato.pxeger.com/run?1=TZHLSsNQEEBxm69IECHBtMzjzn1Urgt3fkOoILRipMTQphhwrQjduXXTTT9Kl_0Sb5O0lGEGZpg58_rZvawX5eN2u1s3TyP7e5e0k8l91Xh6aKMkbfPaU-br5essLUe36dtzuZin9bXHbHyV0qQeYbb_2sC8mt3UD0mZ5W3Wk_4u3pv5qlnFvogKmObx5f7zO-aoCM7JY08mKjCPKY_5FCXcbz6EKFhD7JkUGQDRJIfqPMZprwODoEvvi9CjEGitnXZkmV2oJeMcgXMWRRkUJm0CCfJBjiQUQOmmwTM-InR9D4FgTm2tUsziuEfFw1pnMK00oSNhUQDsoB-_O0WvQyLZkKS1ZTFiUIF2FsSCUcqwEyXWoQaHDkmx0WF8zUQSdjJC2gZ8NI3qZVk1i2qcjpPu6MMPjl_9Bw)
-2 bytes by MarcMush.
Doesn't use prime built-ins, which are not in Base anyway. Feels a bit weird to include a type annotation while golfing in a language that doesn't require it, but it looks like a decent way to disambiguate between numbers and lists.
Note that this will only produce correct output within Int64. At the expense of 5 bytes, we can add a `big(...)` wrapper to get a version that processes all test cases as desired:
## [Julia](https://julialang.org), ~~73~~ 71 bytes
```
!x::Int=big(2)^x
!(x,p=2)=prod(i->(while(p+=1).%(2:p-1)∋0end;p^!i),x)
```
[Attempt This Online!](https://ato.pxeger.com/run?1=TZHLSsNQEEBxm69IECHBtMzjzn1UrlvxG0oLSqtGSgxtigHXitCdWzfd9KN02S_xNomlDDMww8yZ1_fueb0o7rbb3bp-GNifm6QZjW7L2t8Xjyll0yZK0iavPGW-Wr7M0mJwnb4-FYt5Wl16zIYXKY2qAWb7zw3My9lVNU2KLG-yDvd79lbPV_Uq9uNoDJM8Pt9_fMUcjYNz9NiTicaYx5THfIwS7jfvQhSsIfZMigyAaJJDdR7jpNOeQdCmd0XoUQi01k47sswu1JJxjsA5i6IMCpM2gQR5L_8kFEBpp8ETPiK0fQ-BYI5trVLM4rhDxf1aJzCtNKEjYVEA7KAbvz1Fp30i2ZCktWUxYlCBdhbEglHKsBMl1qEGhw5JsdFhfM1EEnYyQtoGfDSJqmVR1otymA6T9uj9D_5f-wc)
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~23~~ 19 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
o"Ddië®δ.VāØsmP"©.V
```
Also works for loose integer inputs, instead of just (ragged) lists.
[Try it online](https://tio.run/##yy9OTMpM/f8/X8klJfPw6kPrzm3RCzvSeHhGcW6A0qGVemH//0dHG@gYxgIRAA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfeX/fCWXlMzDqw@tO7dFL@xI4@EZxbkBSodW6oX91/kfbaCjEG0QCySAJIgy1DHSMYbwdQxjQQgkZghhRANJIAYxDXQgOiB6QUaAUSwA).
**Explanation:**
Recursive functions are always so verbose in 05AB1E.. :/
```
o            # Take 2 to the power each inner-most integer of the (implicit) input
 "..."       # Push the recursive string explained below
      ©      # Store it in variable `®`
       .V    # Evaluate and execute it as 05AB1E code
             # (after which the result is output implicitly)
D            # Duplicate the current list
 di          # If it's a single integer:
             #  (do nothing, simply keep it as is)
  ë          # Else (it's a list instead):
    δ        #  Map over each inner item:
   ® .V      #   Do a recursive call
       ā     #  Then push a list in the range [1,length] (without popping)
        Ø    #  Map index each to the 0-based prime: [3,5,7,...]
         s   #  Swap the two lists on the stack
          m  #  Take the primes to the power of the values
           P #  Take the product of this list
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 67 bytes
```
≔Ｘ²Ａθ⊞υθＦυＦΦι⁺⟦⟧κ⊞υκＦ⮌υ«≔¹η≔²ζＦι«≦⊕ζＷ¬⬤…²ζ﹪ζμ≦⊕ζ≧×Ｘζ⊟⁺⟦⁰⟧κη»⊞ιη»Ｉ⊟θ
```
[Try it online!](https://tio.run/##fZBNa8MwDIbPya/QUQYPtl57KoNBDy0h9FZ6MKkXmzp26o8WMvrbMzt2dpzBWELvI@l1J5jtDFPzvHNO9hob8@QWNxT2egweCaFwJ9u6CU5gyPG3sYCBwPJ@SeUjICk0Kjg8XyjcCCGwArcVaPmDW8cjSOCnrsq4DwoiKtY0zp1SuhByEVYHNpbqXneWD1x7fi266imk4oBH43GnFLZM9zx3oXAw16AMThQGklb6t9FfsZW98HiSA3fR0/IbUwpGzAbfi8Oy@KuuFqsy56@6sVJ7/GTOY4LuUbqd53M8icz3Mr891C8 "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
≔Ｘ²Ａθ
```
Vectorised raise `2` to the power of the input.
```
⊞υθＦυＦΦι⁺⟦⟧κ⊞υκＦ⮌υ«
```
Extract all of the sublists and loop over them in reverse.
```
≔¹η≔²ζ
```
Start with a product of `1` and a last prime of `2`.
```
Ｆι«
```
Loop over the elements of the list.
```
≦⊕ζＷ¬⬤…²ζ﹪ζμ≦⊕ζ
```
Get the next prime number by trial division (1 byte shorter than Wilson's theorem).
```
≧×Ｘζ⊟⁺⟦⁰⟧κη»
```
Multiply the product by the prime power of the next list element (but if that's a list, then use its last element, as that's where we put the value on a previous loop iteration).
```
⊞ιη
```
Save the resulting value to the sublist.
```
»Ｉ⊟θ
```
Output the resulting value of the original list.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 23 bytes
```
L?sIb^2b*F^V.fP_Zlb3yMb
```
[Try it online!](https://tio.run/##K6gsyfj/38e@2DMpzihJyy0uTC8tID4qJ8m40jfpf@X/6Ohog1gdBQgGAA "Pyth – Try It Online")
Defines an encoding function `y(b)`.
### Explanation
```
L                          # define y(b)
 ?sIb                      # if b is invariant under s: (sums for list, int for int)
     ^2b                   #   2 ^ b
                           # else:
                    yMb    #   apply y to each element of b
            .fP_Zlb3       #   generate a list of len(b) primes starting with 3
          ^V               #   vectorized exponentiation
        *F                 #   fold over multiplication
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 37 bytes
```
1##&@@(i=1;Prime@++i^#&/@#)&//@(2^#)&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2b731BZWc3BQSPT1tA6oCgzN9VBWzszTllN30FZU01f30HDKA7I@A@UyiuJVta1S3NQjlWrC05OzKur5qo2qNXhqgaSIMpQx0jHGMLXMawFIS6gAh0ohKgwBAtXVwNJIAYxDXQg@iEmgQwEI67a/wA "Wolfram Language (Mathematica) – Try It Online")
```
                               (2^#)    numbers: x -> 2^x
                            //@         lists:
1##&@@(                /@#)               product of
       i=1;Prime@++i^#&                     prime(n+1)^x_n
```
[Answer]
# [J](http://jsoftware.com/), 32 30 bytes
```
*/@(p:@#\^$:&>)`(2^x:)@.(0=L.)
```
[Try it online!](https://tio.run/##y/pvqWhlGGumaGWprs6lpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/tfQdNAqsHJRj4lSs1Ow0EzSM4iqsNB30NAxsffQ0/2typSZn5CukKdjYGMCYhtZG1sYwjoaBtaGmtSHXfwA "J – Try It Online")
*-2 thanks to att*
[Answer]
# [Factor](https://factorcode.org/) + `math.primes.lists math.unicode`, 83 bytes
```
: g ( a -- n ) dup real? [ 2^ ] [ [ lprimes cdr lnth swap g ^ ] map-index Π ] if ;
```
[Try it online!](https://tio.run/##TY49DsIwDIV3TvFGGFoVRhgYEQsLYqpAilIXIlI3JKkAVdyFE3GlkjYgkCX/fO/Zcimkr2232643qznOZJk0KuFPcHRpiCW5YUwbVrIuCMaS93djFfsolA1Lr2r@@IJSkUu1ct4h5gXWmzmOtS67UDCGQJKAMUHRGFgSeokcswP2oeTQ8QRkYaG5/@QqTNjr9UqYRHFBN7yeYVQlFl2L6RCP4ElHLdqhj/nLMvQ8G0j254ws@9HuDQ "Factor – Try It Online")
[Answer]
# [PowerShell Core](https://github.com/PowerShell/PowerShell), 147 bytes
```
$f={$r,$p=1,2
$args|%{do{$p++;for($u,$k=1,0;++$u-$p){$k+=!($p%$u)}}while($k)$r=$r*($b=[bigint])::Pow($p,(&($f,{$b::Pow(2,$_)})[$_-is[int]]@_))}
$r}
```
[Try it online!](https://tio.run/##ZVJbb9owFH7nV3jotIqHI/kSO3GrSJnY9rCXVeveEEJATWFQnDnJ2JTmtzOHFAbDShzpfOe7HMe53RlXLM1mE86tM/s9LNIaHIE8ZYT3YOqei9eb@snWkA8G9wvrAqgIrD1K7wcDqELIcQ3rQfougPwGKtw0u@VqYwJYY3ApuPcBzNLRbPW82pZjfHf3YHe@kwS3ASxIDbOuwglMcINHMAlXxahtHWcTjJseuGafBT3kF0FZkAUUE9QXfXxWaneK2zqPLwBGECdIHBg84jGlUnF50eKZBDHcvX0mOVVKaaV5IoT2FB5rzanWCZNRzKTgKr4U8PR/T6dBmfw/BjsaMHoVoAXa/RAziSIhpBbXLmdzvvmoSHGmuRQyolRoej1bd1z0ROGJb1cqETKWMYuo0gmVCY2jKBZaRjLRTFHNNOORiJUfVwnOpT@DWHKVeCOvj9Er@mzdp@l8GX6d/TDzEtUHU39Z3PQPQWB@575qnlCKYNJBZ6XjXfA/fuoKf1GOWBcdnCmqTekbb2GBsoPmARg9PA6rorQvnek461zb9VjN56YoWr@TUWh@HrVOfR9aMf9N37L6SYZ2@8u48rsNvxR2i8KhfcldqxV@NHm5RIye2N@6YC37TLfpNfu/ "PowerShell Core – Try It Online")
Fun challenge!
Recursive function that expects the input list using splatting and returns a `[bigint]`
Please ignore the inconsistent output of the array in the tests result as PowerShell has a tendency to flatten them sometime.
## Explanation
This part updates `$p` to become the next prime after `$p`
```
do{$p++;for($u,$k=1,0;++$u-$p){$k+=!($p%$u)}}while($k)
```
This part checks whether the current list item `$_` is a number or not
If it is a number, we take its power of two, otherwise, we do a recursive call.
```
$r=$r*($b=[bigint])::Pow($p,(&($f,{$b::Pow(2,$_)})[$_-is[int]]@_))}
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 71 bytes
Of course, answering your own challenge is a bit ridiculous, but it is rather a supplement to not break the main post.  
Thanks @PaŭloEbermann for the idea!  
It seems we can account for *the empty lists*, naively but correctly, using the next encoding:
1. If \$x\$ is non-negative integer, \$G(x) = 2^{x+1}\$
2. If \$x\$ is an empty list, `[ ]`, \$G(x) = 2^0 = 1\$
3. If \$x\$ is a list, \$[n\_0, n\_1, n\_2, n\_3, …], 
G(x) = 3^{G(n\_0)} \cdot 5^{G(n\_1)} \cdot 7^{G(n\_2)} \cdot 11^{G(n\_3)} \cdot...\$
Of course, this is a purely intuitive idea without proof. But I do not see contradictions at the moment.
So here is Mathematica program that encodes *any array-like structure* (with possible empty lists) with a unique positive integer.
```
Switch[#,{},1,{__},Times@@(Prime@Range[2,Length@#+1]^#0/@#),_,2^(#+1)]&
```
Some related test cases:
```
[] → 1
[[]] → 3
[[], 1, []] → 13125
[[], [0, []], 1] → 204721573027200065553188323974609375
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2b7P7g8syQ5I1pZp7pWx1CnOj6@VickMze12MFBI6AIyHAISsxLT4020vFJzUsvyXBQ1jaMjVM20HdQ1tSJ1zGK0wAKaMaq/QcqzitxSHOoBpqjUG0AxLVAhmHtfwA "Wolfram Language (Mathematica) – Try It Online")
[Answer]
# [PARI/GP](https://pari.math.u-bordeaux.fr), 51 bytes
```
f(x)=if(x'===0,2^x,prod(i=1,#x,prime(i+1)^f(x[i])))
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m728ILEoMz69YMGCpaUlaboWN43TNCo0bTOBpLqtra2BjlFchU5BUX6KRqatoY4yiJ2Zm6qRqW2oGQdUE50Zq6mpCdWaklhQkFOpkaiga6cAVJZXAmQqgThKCmkaiZqaOgrR0QY6UBgL5BnqKIAQiBkNJg1jQaQBWCGICVYFYkOYQDGoXTDnAgA)
]