First, find the n nth roots of unity. eg if n = 6, find the n distinct (complex) numbers such that n^6 = 1.
https://en.wikipedia.org/wiki/Root_of_unity
Second, raise each root to the power pi (.^pi).
Third, sum the resulting numbers and use that as the output.
Return the largest number that is adjacent to a zero
3109 Solvers
2725 Solvers
193 Solvers
Let's get back to school, and create multiplication tables
103 Solvers
112 Solvers
Solution 1497321
Surely I shouldn't done this ugly string thing, that is bad for everyone. Without any doubt, Tim's solution is the best one