

One form of   Pythagorean quadruples   is   (for positive integers   a,   b,   c,   and   d):



    a2   +   b2   +   c2     =     d2 


An example:

    22   +   32   +   62     =     72 
 which is:
    4    +   9    +   36     =     49 


Task

For positive integers up   2,200   (inclusive),   for all values of   a,  
b,   c,   and   d,

find   (and show here)   those values of   d   that   can't   be represented.

Show the values of   d   on one line of output   (optionally with a title).



Related tasks

   Euler's sum of powers conjecture. 
   Pythagorean triples.


Reference

   the Wikipedia article:   Pythagorean quadruple.


func missingD(upTo n: Int) -> [Int] {
  var a2 = 0, s = 3, s1 = 0, s2 = 0
  var res = [Int](repeating: 0, count: n + 1)
  var ab = [Int](repeating: 0, count: n * n * 2 + 1)
 
  for a in 1...n {
    a2 = a * a
 
    for b in a...n {
      ab[a2 + b * b] = 1
    }
  }
 
  for c in 1..<n {
    s1 = s
    s += 2
    s2 = s
 
    for d in c+1...n {
      if ab[s1] != 0 {
        res[d] = 1
      }
 
      s1 += s2
      s2 += 2
    }
  }
 
  return (1...n).filter({ res[$0] == 0 })
}
 
print(missingD(upTo: 2200))