# Mathematica code ❌


### distinctToOdd



```
(* Helper function to split even numbers until no evens remain *)
splitEven[n_] := 
 If[EvenQ[n], Flatten[{splitEven[n/2], splitEven[n/2]}], n]

(* Function to convert a partition with distinct parts to odd parts *)
distinctToOdd[partition_List] := Flatten[splitEven /@ partition]
```

### oddToDistinct


```
oddPartitionsOf13=IntegerPartitions[13, Infinity, Range[1, 13, 2]];
```




# Reference


Use the method found on OEIS [A000009][1].



Bijection: given n = L1\*1 + L2\*3 + L3\*5 + L7\*7 + ..., a partition into odd parts, write each Li in binary, Li = 2^a1 + 2^a2 + 2^a3 + ... where the aj's are all different, then expand n = (2^a1 * 1 + ...)\*1 + ... by removing the brackets and we get a partition into distinct parts. For the reverse operation, just keep splitting any even number into halves until no evens remain.


 [1]: https://oeis.org/A000009