Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

deleted 314 characters in body
Source Link
ovs
  • 61.2k
  • 3
  • 49
  • 164

Python 3, 153 bytes

lambda a,c:a**c

Try it online!

or

complex.__pow__pow

Try it online! Try it online!

Input and output as complex numbers.


Python 3, 47 bytes

def f(a,b,c):n=(a+b*1j)**c;return n.real,n.imag

Try it online!

Input and output as integers


Python 2, (削除) 62 (削除ここまで) 60 bytes

-2 bytes thanks to @Leonhard

a,b,c=input();d=1;e=0
exec'd,e=a*d-b*e,a*e+b*d;'*c
print d,e

Try it online!

does not use complex number type

Python 3, 15 bytes

lambda a,c:a**c

Try it online!

or

complex.__pow__

Try it online!

Input and output as complex numbers.


Python 3, 47 bytes

def f(a,b,c):n=(a+b*1j)**c;return n.real,n.imag

Try it online!

Input and output as integers


Python 2, (削除) 62 (削除ここまで) 60 bytes

-2 bytes thanks to @Leonhard

a,b,c=input();d=1;e=0
exec'd,e=a*d-b*e,a*e+b*d;'*c
print d,e

Try it online!

does not use complex number type

Python 3, 3 bytes

pow

Try it online!

Input and output as complex numbers.


Python 3, 47 bytes

def f(a,b,c):n=(a+b*1j)**c;return n.real,n.imag

Try it online!

Input and output as integers


Python 2, (削除) 62 (削除ここまで) 60 bytes

-2 bytes thanks to @Leonhard

a,b,c=input();d=1;e=0
exec'd,e=a*d-b*e,a*e+b*d;'*c
print d,e

Try it online!

does not use complex number type

Rollback to Revision 7
Source Link
ovs
  • 61.2k
  • 3
  • 49
  • 164

Python 3, 315 bytes

powlambda a,c:a**c

Try it online! Try it online!

or

complex.__pow__

Try it online!

Input and output as complex numbers.


Python 3 , 47 bytes

def f(a,b,c):n=(a+b*1j)**c;return n.real,n.imag

Try it online!

Input and output as integers


Python 2, (削除) 62 (削除ここまで) 60 bytes

-2 bytes thanks to @Leonhard

a,b,c=input();d=1;e=0
exec'd,e=a*d-b*e,a*e+b*d;'*c
print d,e

Try it online!

does not use complex number type

Python 3, 3 bytes

pow

Try it online!

Input and output as integers


Python 2, (削除) 62 (削除ここまで) 60 bytes

-2 bytes thanks to @Leonhard

a,b,c=input();d=1;e=0
exec'd,e=a*d-b*e,a*e+b*d;'*c
print d,e

Try it online!

does not use complex number type

Python 3, 15 bytes

lambda a,c:a**c

Try it online!

or

complex.__pow__

Try it online!

Input and output as complex numbers.


Python 3 , 47 bytes

def f(a,b,c):n=(a+b*1j)**c;return n.real,n.imag

Try it online!

Input and output as integers


Python 2, (削除) 62 (削除ここまで) 60 bytes

-2 bytes thanks to @Leonhard

a,b,c=input();d=1;e=0
exec'd,e=a*d-b*e,a*e+b*d;'*c
print d,e

Try it online!

does not use complex number type

deleted 782 characters in body
Source Link
ovs
  • 61.2k
  • 3
  • 49
  • 164

Python 3, 15 bytes

lambda a,c:a**c

Try it online!

or

complex.__pow__

Try it online!

Input and output as complex numbers.


Python 3 , 473 bytes

def f(a,b,c):n=(a+b*1j)**c;return n.real,n.imagpow

Try it online! Try it online!

Input and output as integers


Python 2, (削除) 62 (削除ここまで) 60 bytes

-2 bytes thanks to @Leonhard

a,b,c=input();d=1;e=0
exec'd,e=a*d-b*e,a*e+b*d;'*c
print d,e

Try it online!

does not use complex number type

Python 3, 15 bytes

lambda a,c:a**c

Try it online!

or

complex.__pow__

Try it online!

Input and output as complex numbers.


Python 3 , 47 bytes

def f(a,b,c):n=(a+b*1j)**c;return n.real,n.imag

Try it online!

Input and output as integers


Python 2, (削除) 62 (削除ここまで) 60 bytes

-2 bytes thanks to @Leonhard

a,b,c=input();d=1;e=0
exec'd,e=a*d-b*e,a*e+b*d;'*c
print d,e

Try it online!

does not use complex number type

Python 3, 3 bytes

pow

Try it online!

Input and output as integers


Python 2, (削除) 62 (削除ここまで) 60 bytes

-2 bytes thanks to @Leonhard

a,b,c=input();d=1;e=0
exec'd,e=a*d-b*e,a*e+b*d;'*c
print d,e

Try it online!

does not use complex number type

added 406 characters in body; added 314 characters in body
Source Link
ovs
  • 61.2k
  • 3
  • 49
  • 164
Loading
added 250 characters in body; added 31 characters in body; added 1 character in body
Source Link
ovs
  • 61.2k
  • 3
  • 49
  • 164
Loading
Rollback to Revision 3
Source Link
ovs
  • 61.2k
  • 3
  • 49
  • 164
Loading
added 31 characters in body
Source Link
ovs
  • 61.2k
  • 3
  • 49
  • 164
Loading
added 478 characters in body
Source Link
ovs
  • 61.2k
  • 3
  • 49
  • 164
Loading
deleted 391 characters in body
Source Link
ovs
  • 61.2k
  • 3
  • 49
  • 164
Loading
Source Link
ovs
  • 61.2k
  • 3
  • 49
  • 164
Loading

AltStyle によって変換されたページ (->オリジナル) /