10
1
Given two integers, which may be negative, zero, or positive, a
and b
(taken in any reasonable format, including inputting a plain complex number), convert it to a + bi
where i
is the imaginary number (square root of negative one). Then, raise it to the power of a third (positive integer) input variable, c
as to (a + bi)c
. You should then end up with something like d + ei
. You must then output, or return, d
and e
in any reasonable format (including outputting a plain complex number).
Input and output may be taken or outputted in any order.
Examples:
5, 2, 2 -> 21, 20
1, 4, 2 -> -15, 8
-5, 0, 1 -> -5, 0
If we use de Moivre's formula, is floating point imprecison allowed? – Giuseppe – 2017-10-14T12:03:04.180
@Giuseppe Yes, that's okay. – Okx – 2017-10-14T13:12:59.857
4FWIW I think the change to the rules (allowing a fully flexible I/O) made a fairly interesting challenge pretty dull. – Jonathan Allan – 2017-10-15T20:50:10.017
@JonathanAllan at least for languages with native complex number support -- which are quite many :( – Felix Palmen – 2017-10-17T11:22:54.497
@JonathanAllan I can't please everyone :( – Okx – 2017-10-17T12:08:03.163
@Okx I know, just pointing out to others that I (and it seems from upvotes, others) prefered your original idea :) – Jonathan Allan – 2017-10-17T12:43:12.497