# Swap prime exponents with their neighbours

## Jelly, 10 bytes

```
ÆE;0s2UFÆẸ
```

Try it online! or verify all test cases.

### How it works

```
ÆE;0s2UFÆẸ Main link. Argument: n
ÆE Yield the exponents of n's prime factorization.
;0 Append a zero.
s2 Split into pairs.
U Upend; reverse each pair.
F Flatten the resulting list of pairs.
ÆẸ Convert the prime exponents to integer.
```

## Jelly, ~~17~~ ~~16~~ 11 bytes

5 bytes thanks to Dennis.

```
ÆfÆC’^1‘ÆNP
```

Try it online!

### Explanation

```
ÆfÆC’^1‘ÆNP Main monadic chain. Argument: n
Æf Yield the prime factors of n.
ÆC For each factor, count the number of primes below it.
This effectively yields their indices.
’ Decrement [each] by 1.
^1 Xor with 1
‘ Increment [each] by 1.
ÆN Find their corresponding primes.
P Yield their product.
```

### Previous 16-byte version

```
ÆnÆRiÐ€Æf’^1‘ÆNP
```

Try it online!

### Explanation

```
ÆnÆRiÐ€Æf’^1‘ÆNP Main monadic chain. Argument: n
Æn Yield the next prime from n.
ÆR Yield all primes from 2 to it.
Æf Yield prime factors of n
iÐ€ Yield their index in the prime list.
’ Decrement [each] by 1.
^1 Xor with 1
‘ Increment [each] by 1.
ÆN Find their corresponding primes.
P Yield their product.
```

### Previous 17-byte version:

```
ÆnÆR©iÐ€Æf’^1‘ị®P
```

Try it online!

### Explanation

```
ÆnÆR©iÐ€Æf’^1‘ị®P Main monadic chain. Argument: n
Æn Yield the next prime from n.
ÆR Yield all primes from 2 to it.
© Store to register.
Æf Yield prime factors of n
iÐ€ Yield their index in the prime list.
’ Decrement [each] by 1.
^1 Xor with 1
‘ Increment [each] by 1.
ị® Find their corresponding primes in
the list in register.
P Yield their product.
```

## Python 2, ~~149~~ 139 bytes

10 bytes thanks to Dennis.

```
n=input()
p=f=1;w=[2]
while w[-1]<=n:f*=p;p+=1;w+=[p]*(-~f%p<1)
r=p=1;w=w[1:]
while n>1:
p+=1
while n%p<1:n/=p;r*=w[w.index(p)^1]
print r
```