[Question]
  [
A [Gaussian integer](https://en.wikipedia.org/wiki/Gaussian_integer) is a complex number whose real and imaginary parts are integers.
Gaussian integers, like ordinary integers, can be represented as a product of Gaussian primes, in a unique manner. The challenge here is to calculate the prime constituents of a given Gaussian integer.
Input: a Gaussian integer, which is not equal to 0 and is not a [unit](https://en.wikipedia.org/wiki/Unit_(ring_theory)) (i.e. 1, -1, i and -i can not be given as inputs). Use any sensible format, for example:
* 4-5i
* -5\*j+4
* (4,-5)
Output: a list of Gaussian integers, which are prime (i.e. no one of them can be represented as a product of two non-unit Gaussian integers), and whose product is equal to the input number. All numbers in the output list must be non-trivial, i.e. not 1, -1, i or -i. Any sensible output format can be used; it should not necessarily be the same as input format.
If the output list has more than 1 element, then several correct outputs are possible. For example, for input 9 the output can be [3, 3] or [-3, -3] or [3i, -3i] or [-3i, 3i].
Test cases, (taken from [this table](https://en.wikipedia.org/wiki/Table_of_Gaussian_integer_factorizations); 2 lines per test case)
```
2
1+i, 1-i
3i
3i
256
1+i,1+i,1+i,1+i,1+i,1+i,1+i,1+i,1+i,1+i,1+i,1+i,1+i,1+i,1+i,1+i
7+9i
1+i,2‚àíi,3+2i
27+15i
1+i,3,7‚àí2i
6840+585i
-1-2i, 1+4i, 2+i, 3, 3, 6+i, 6+i
```
Built-in functions for factoring Gaussian integers are not allowed. Factoring ordinary integers by built-in functions is allowed though.
  
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~258~~ ~~256~~ ~~249~~ 246+8 = ~~264~~ ~~257~~ 254 bytes
Uses the `-rprime` flag.
Geez, what a mess.
[Uses this algorithm from stackoverflow.](https://stackoverflow.com/questions/2269810/whats-a-nice-method-to-factor-gaussian-integers)
```
->c{m=->x,y{x-y*eval("%d+%di"%(x/y).rect)};a=c.abs2.prime_division.flat_map{|b,e|b%4<2?(1..e).map{k=(2..d=b).find{|n|n**(~-b/2)%b==b-1}**(~-b/4)%b+1i;d,k=k,m[d,k]while k!=0;c/=d=m[c,d]==0?d:d.conj;d}:(c/=b<3?(b=1+1i)**e:b**e/=2;[b]*e)};a[0]*=c;a}
```
[Try it online!](https://tio.run/##LY/raoNAGERfJQ0Iu6uul5oSNF98ECviXmy3XtFNqqh99FoT@mcGzsDA6W9s2gp43@wrn2uwr6M1zaM9EXnPK3Q0hGkIdTTQ6EyY9pJrvEY5cJqzwaddr2qZCXVXg2obWlS5zuq8mxdmyYUZwcWPkUepxPRBS0A@pQIYpoVqxLw0S0MI@rGZ42ODATDbW/9BsAPTU5GwSiitOtk7/f5UlTyUL@BG3AEBdcItkQK4sQgF5W3zFYk1RPvGLq8xYuDtD5gQGbI9HPCjhKVEPgQSNyXAo3zdupseDkXytP2QesBUtxlPt7dz4Jqn80n9tp3e5YbN7p@6fw "Ruby ‚Äì Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), ~~250~~ ~~239~~ ~~223~~ 215 bytes
```
e,i,w=complex,int,abs
def f(*Z):
 if Z:
	z=Z[0];q=i(w(z));Q=4*q*q
	while Q>0:
 	 a=Q/q-q;b=Q%q-q;x=e(a,b)
 	 if w(x)>1:
		y=z/x
		if w(y)>1 and y==e(i(y.real),i(y.imag)):f(x,y);z=Q=0
 	 Q-=1
	if z:print z
	f(*Z[1:])
```
[Try it online!](https://tio.run/##VY7BboMwEETP@Ct8qeQF0wBJEwHa/IOvRDk4jd04IgTSSGD/PLVbtSqn3Xk7O5rePi/3rphnxQ0f8f1@61s1cdM9uTx9krPSVLO4gYpQo2lTkchhc8iO9YCGjcwB1AI38RAPJBovplVU7DNvjqhEsRrSoT6heAlzQsUkP0G4@aiRTbDPfV5k0a0mP7@h9ZDK7kwter9h9vWhZAs8bOYmPwAqzSZuoXYoMAthIsWchG9X9Q9fnDoShc6HvDrCrFkB9Q@nRLO0SNbr6y/xYCF2SXn97y52Sf62IGWZbBdgu/lT8xc "Python 2 ‚Äì Try It Online")
* -11 bytes when using *Multiple Function Arguments*
* -2¬≤\*¬≤ bytes when using one variable to parse couples `(a,b)`
* -2¬≥ bytes when mixing tabs and spaces: thanks to ovs
**Some explanation** recursively decompose a complex to two complexes until no decomposition is possible... 
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~61~~ ~~55~~ 50 bytes
```
√Üi·∏§p/-,1p`¬§√ó‚Ç¨√ó1,ƒ±Fs2S‚Ç¨‚Å∏√∑√Üi·∏û∆ë$∆á·ªä√ê·∏ü1;·π™√∞,√∑@\·∏ü1
√á‚Ç¨F$√êL
```
[Try it online!](https://tio.run/##y0rNyan8f3TSw50zjk5@uHPxo4Y5hlmPGuaCMUxE2wDEfbirDyagCxN4uGM@kBsdq6GpABR41LgvK7Py/@G2zIc7lhTo6@oYFiQcWnJ4@qOmNYenG@oc2ehWbBQM5Dxq3HF4O1jVvGMTVY61P9zddXgC0ChD64c7Vx3eoHN4u0MMiMt1uB2o2k3l8ASf/zqH2w9PBPL8gTbPsTq09dDWRw0zHu7uAdJNayL//482AroyVifaQNsYRBmZmkH45tqWYL65tqFpViwA "Jelly ‚Äì Try It Online") (Header and Footer formats the output)
*-6 bytes thanks to @EricTheOutgolfer*
*-5 bytes thanks to @caird coinheringaahing*
**How it Works**
```
√Üi·∏§p/-,1p`¬§√ó‚Ç¨√ó1,ƒ±Fs2S‚Ç¨‚Å∏√∑√Üi·∏û∆ë$∆á·ªä√ê·∏ü1;·π™√∞,√∑@\·∏ü1 - helper: outputs a factor pair of the input
√Üi·∏§p/                    - creates a list of possible factors a+bi, a,b>=0
      -,1p`¬§√ó‚Ç¨           - extend to the other three quadrants 
              √ó1,ƒ±Fs2S‚Ç¨  - convert to  actual complex numbers 
‚Å∏√∑                       - get quotient with input complex number
  √Üi·∏û∆ë$∆á                    - keep only Gaussian numbers (those unchanged when complex parts are floored)
     ·ªä√ê·∏ü                 - remove units (i,-i,1,-1)
        1;               - append a 1 to deal with primes having no non-unit factors
          ·π™√∞,√∑@\         - convert to a factor pair
                ·∏ü1       - remove 1s
√á‚Ç¨F$√êL
√á‚Ç¨      - factor each number
   $    - and
  F     - flatten the list
    √êL  - until factoring each number and flattening does not change the list
```
[Answer]
# [Rust](https://rust-lang.org) - 212 bytes
```
use num::complex::Complex as C;fn f(a:&mut Vec<C<i64>>){for _ in 0..2{for x in -999..0{for y in 1..999{for i in 0..a.len(){let b=C::new(x,y);if(a[i]%b).norm_sqr()==0&&(a[i]/b).norm_sqr()>1{a[i]/=b;a.push(b)}}}}}}
```
I'm not 100% sure if this works 100% correct, but it seems to be correct for a large range of tests. This isn't smaller than Jelly, but at least it is smaller than the interpreted languages (so far). It also seems to be faster and can work through inputs of a billion magnitude in less than a second. For example 1234567890+3141592650i factors as (-9487+7990i)(-1+-1i)(-395+336i)(2+-1i)(1+1i)(3+0i)(3+0i)(4+1i)(-1+1i)(-1+2i), [(click here to test on wolfram alpha)](https://www.wolframalpha.com/input/?i=(-9487%2B7990i)(-1%2B-1i)(-395%2B336i)(2%2B-1i)(1%2B1i)(3%2B0i)(3%2B0i)(4%2B1i)(-1%2B1i)(-1%2B2i))
This started out as the same idea as naive factoring of integers, to go through each number below the integer in question, see if it divides, repeat until done. Then, inspired by other answers, it morphed... it repeatedly factors items in a vector. It does this a good number of times, but not 'until' anything. The number of iterations has been chosen to cover a good chunk of reasonable inputs.
It still uses "(a mod b) == 0" to test whether one integer divides another (for Gaussians, we use builtin Rust gaussian modulo, and consider "0" as norm == 0), however the check for 'norm(a/b) != 1' prevents dividing "too much", basically allowing the resulting vector to be filled with only primes, but not taking any element of the vector down to unity (0-i,0+i,-1+0i,1+0i) (which is prohibited by the question).
The for-loop limits were found through experiment. y goes from 1 up to prevent divide-by-zero panics, and x can go from -999 to 0 thanks to the mirroring of Gaussians over the quadrants (I think?). As regarding the limitations, the original question did not indicate a valid range of input/output, so a "reasonable input size" is assumed... (Edit... however i am not exactly sure how to calculate at which number this will begin to "fail", i imagine there are Gaussian integers that are not divisible by anything below 999 but are still surprisingly small to me) 
Try the somewhat ungolfed version on [play.rust-lang.org](https://play.rust-lang.org/?version=stable&mode=release&edition=2018&gist=d3afa7b4de68598232516661fe4f1f22)
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), ~~141~~ 124 bytes
*Thanks to Jo King for -17 bytes*
```
sub f($_){{$!=0+|sqrt .abs¬≤-$^a¬≤;{($!=$_/my \w=$^b+$a*i)==$!.floor&&.abs>w.abs>1>return f w&$!}for -$!..$!}for ^.abs;.say}
```
[Try it online!](https://tio.run/##LYtNDoIwGETXcIoP0xCwgviPNrD0FARSDE1I0GqLIVC5FEfgYliMm5fJzJtnIarjNMl3DsxBmasUsqIAf@RL1ODTXI6Dh1I6DkQ5ekHZ@t5C0kQozTGiy9KNImT5rOJc2Pbsx82Pm1gU9Vs8gEFjI6tnXICnTf@f09kivqRtPxFzbpwtDsoVBHinecJnzWO4D/AhPJQueDEkHSjT0A9YXOmt5kICZ6C6/rIgpsGcziVmP30B "Perl 6 ‚Äì Try It Online")
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), ~~54~~ ~~51~~ ~~45~~ ~~42~~ 36 bytes
```
 .W>H1cZ
h+.aDf!%cZT1>#1.jM^s_BM.aZ2
```
[Try it online!](https://tio.run/##K6gsyfj/X0Ev3M7DMDmKK0NbL9ElTVE1OSrE0E7ZUC/LN6443sk3VC8xyuj/fyMA "Pyth ‚Äì Try It Online")
Accepts input in the form `1+2j` - purely real or imaginary numbers can omit the other component (e.g. `9`, `2j`). Output is a newline-separated list of complex numbers, in the form `(1+2j)`, with purely imaginary numbers omitting the real part.
This uses simple trail division, generating all gaussian integers with magnitude greater than 1 and less than the current value, plus the value itself. These are filtered to keep those that are a factor of the value, and the smallest by magnitude is chosen as the next prime factor. This is output, and the value is divided by it to produce the value for the next iteration.
Also, Pyth beating Jelly üò≤ (I don't expect it to last though)
```
 .W>H1cZ¬∂h+.aDf!%cZT1>#1.jM^s_BM.aZ2ZQ   Implicit: Q=eval(input())
                                         Newline replaced with ¬∂, trailing ZQ inferred
 .W                                  Q   While <condition>, execute <inner>, with starting value Q
   >H1                                   Condition function, input H
   >H1                                     Is magnitude of H > 1?
                                           This ensures loop continues until H is a unit, i.e. 1, -1, j, or -j)
      cZ¬∂h+.aDf!%cZT1>#1.jM^s_BM.aZ2Z    Inner function, input Z
                                .aZ        Take magnitude of Z
                             _BM           Pair each number in 0-indexed range with its negation
                            s              Flatten
                           ^       2       Cartesian product of the above with itself
                        .jM                Convert each pair to a complex number
                      #                    Filter the above to keep those element where...
                     > 1                   ... the magnitude is greater than 1 (removes units)
              f                            Filter the above, as T, to keep where:
                 cZT                         Divide Z by T
                %   1                        Mod real and imaginary parts by 1 separately
                                             If result of division is a gaussian integer, the mod will give (0+0j)
               !                             Logical NOT - maps (0+0j) to true, all else to false
                                           Result of filter are those gaussian integers which evenly divide Z
           .aD                             Sort the above by their magnitudes
          +                         Z      Append Z - if Z is ¬±1¬±1j, the filtered list will be empty
         h                                 Take first element, i.e. smallest factor
        ¬∂                                  Print with a newline
      cZ                                   Divide Z by that factor - this is new input for next iteration
                                         Output of the while loop is always 1 (or -1, j, or -j) - leading space suppesses output
```
]