Calculating numbers in the Collatz sequence
Test it

You are asking which one is faster, but did you actually test it yourself?  I'm sure if you did you would find out.

Math.pow()

In your second solution, just using Math.pow() is slower than the entire first solution, probably by an order of magnitude.  I'm not sure why you think using a single if statement would be slower than calling an extremely complicated function (which probably contains lots of if statements).

Avoiding Math.pow

You can compute \$(-1)^n\$ by using the 1 bit, like this: -(2*(n &amp; 1)-1).  So you can change your second solution to:

n = ( (7 * n + 2) + (2*(n &amp; 1)-1) * (5 * n + 2) ) / 4;


This version would be very similar in runtime to the first solution.  I couldn't tell you which would be faster.  I'm also not sure if the division by 4 here will be optimized away.  You may want to convert that into a shift by 2 instead:

n = ( (7 * n + 2) + (2*(n &amp; 1)-1) * (5 * n + 2) ) &gt;&gt; 2;