# J, <s>86</s> <s>62</s> <s>54</s> <s>49</s> <s>47</s> <s>42</s> <s>41</s> 40 bytes (0((+,-)]%_1^i.@#%#)&$:/@|:_2]\])^:(1<#) An improvement after a few years. Still uses the Cooley-Tukey FFT algorithm. Saved 4 bytes using *e*<sup>*πi*</sup> = -1, thanks to @[Leaky Nun](https://codegolf.stackexchange.com/users/48934/leaky-nun). [Try it online!](https://tio.run/##HYu7DoJAFAV7vuJE5LERr/te2KjByt7CSqAwErWxoKGQb1/BnEwmU5x3GHDw4JgJOc/zTbFlTdKJ9kV1nMQsXftd/fWdbG4Na30u9jELLFoRsn55ZigweQzRuJTERDhdztfocX9@0Ke0ovSIMQSB/2ZLKOhgSGorLRRV3OnFTiplYMhpLStoclWpUJLSwok5tXWlASdnuVDVDw) ## Usage f =: (0((+,-)]%_1^i.@#%#)&$:/@|:_2]\])^:(1<#) f 1 1 1 1 4 0 0 0 f 1 2 3 4 10 _2j2 _2 _2j_2 f 5.24626 3.90746 3.72335 5.74429 4.7983 8.34171 4.46785 0.760139 36.9894 _6.21186j0.355661 1.85336j_5.74474 7.10778j_1.13334 _0.517839 7.10778j1.13334 1.85336j5.74474 _6.21186j_0.355661 ## Explanation (0((+,-)]%_1^i.@#%#)&$:/@|:_2]\])^:(1<#) Input: x 1<# Is the input length is greater than one ^: If true, ] Get x _2]\ Split x into sublists of length 2 0 |: Transpose it to get [even-index, odd-index] by moving axis 0 to the end &$:/@ Call recursively on each list # Get the length of the odd list i.@ Range from 0 to that length exclusive %# Divide each value by that length _1^ Compute (-1)^x for each x in it % Divide each value in the odd list ] by a value in the previous elementwise + Add elementwise between the even values and modified odd values - Subtract elementwise between the even values and modified odd values , Join the two lists and return Else Return x (act as identity function)