Mar 26, 2013

Power of -1

To compute (-1)^n one has three options,
$ (-1)^n = (-1)^{\mod(n,2)} = 1-2 \times \mod(n,2) $
i=1,2,...10^8, time in second.

No comments:

Post a Comment