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



Task

Given   n,   find the   nth   roots of unity.




require "complex"
 
def roots_of_unity(n)
  (0...n).map { |k| Math.exp((2 * Math::PI * k / n).i) }
end
 
p roots_of_unity(3)
 