Replace twos with threes Given a positive integer n write some code to take its prime factorization and replace all of its factors of 2 with 3.

For example

12 = 2 * 2 * 3 -&gt; 3 * 3 * 3 = 27


This is code-golf so the goal is to minimize the byte count of your answer.

Test cases

1 -&gt; 1
2 -&gt; 3
3 -&gt; 3
4 -&gt; 9
5 -&gt; 5
6 -&gt; 9
7 -&gt; 7
8 -&gt; 27
9 -&gt; 9
10 -&gt; 15
11 -&gt; 11
12 -&gt; 27
13 -&gt; 13
14 -&gt; 21
15 -&gt; 15
16 -&gt; 81
17 -&gt; 17
18 -&gt; 27
19 -&gt; 19
20 -&gt; 45
21 -&gt; 21
22 -&gt; 33
23 -&gt; 23
24 -&gt; 81
25 -&gt; 25
26 -&gt; 39
27 -&gt; 27
28 -&gt; 63
29 -&gt; 29
Fractran, 3 bytes

3/2


Fractran literally only has one builtin, but it happens to do exactly what this task is asking for. (It's also Turing-complete, by itself.)

The language doesn't really have a standardised syntax or interpreter. This interpreter (in a comment to a blog post –
 it's a very simple language) will accept the syntax shown here. (There are other Fractran interpreters with other syntaxes, e.g. some would write this program as 3 2, or even using 3 and 2 as command line arguments, which would lead to a score of 0+3 bytes. I doubt it's possible to do better than 3 in a pre-existing interpreter, though.)

Explanation

3/2
 /   Replace a factor of
  2  2
3    with 3
     {implicit: repeat until no more replacements are possible}