The purpose of this task is to explore working with   complex numbers.



Task

Given   n,   find the   nth   roots of unity.




F polar(r, theta)
   R r * (cos(theta) + sin(theta) * 1i)
 
F croots(n)
   R (0 .< n).map(k -> polar(1, 2 * k * math:pi / @n))
 
L(nr) 2..10
   print(nr‘ ’croots(nr))