# Every integer vector in $\mathbb R^n$ with integer length is part of an orthogonal basis of $\mathbb R^n$

Suppose $\vec x$ is a (non-zero) vector with integer coordinates in $\mathbb R^n$ such that $\|\vec x\| \in \mathbb Z$. Is it true that there is an orthogonal basis of $\mathbb R^n$ containing $\vec x$, consisting of vectors with integer coordinates, all with the same length?

For example: let $\vec x = \left<2,10,11\right>$, so $\|\vec x\| = 15$. Then the vectors $\left<14,-5,2\right>$ and $\left<5,10,-10\right>$ complete a basis of $\mathbb R^3$.

I've checked all such integer vectors in $\mathbb R^3$ with an integer length up to 17 and found no counter examples. Moreover, these can always be arranged as a symmetric matrix, possibly changing the order (or permuting the coordinates) and changing signs (edit: not always; see answer below). For example, the vectors above can be arranged as:

$$\begin{bmatrix}14&-5&2\\-5&-10&10\\2&10&11\end{bmatrix}$$

This is easily true if $n$ is even (edit: rather, if $n=4$), you can simply permute the entries of $\vec x$ (altering signs appropriately) to find $n-1$ other vectors orthogonal to $\vec x$. In $\mathbb R^3$, finding a second integer vector is sufficient because the cross product of the two (divided by $\|\vec x\|$) will give the third vector of such a basis. Then it is straightforward to prove for special cases (like $\vec x = \left<1,2m,2m^2 \right>$, $m\in \mathbb Z$), but I can't think of a good reason why this should be true in general.

Edited, hopefully for clarity, by o.p. The original phrasing and title referred to $\mathbb Z^n$.

• Any basis for $\mathbb{Z}^n$ will, when reduced modulo $p$, give a basis for $\mathbb{F}_p^n$. Therefore, it's clear that no basis for $\mathbb{Z}^n$ can contain a vector such as $[2,2,2]$. I'm not entirely sure if your conjecture is true if you restrict to vectors whose entries have GCD 1. – user14972 Dec 18 '12 at 4:51
• You are mixing together incompatible terminology. Your example above is a basis for $\mathbb Q^3,$ over the field $\mathbb Q.$ Over the integers $\mathbb Z,$ you will not be able to represent the lattice point $(0,1,0).$ Given an integral lattice, a set of vectors are said to be a basis if they are linearly independent and if they span the lattice with integer coefficients. – Will Jagy Dec 18 '12 at 5:15
• Despite poor wording, I think the OP clearly wants to ask that, given an integer vector $v$ of positive integer length, is it possible to extend it to an orthogonal basis of the Euclidean space, such that every basis vector is an integer vector with the same length as $v$? – user1551 Dec 18 '12 at 5:42
• @user1551, no, let $v = (2,1,0).$ – Will Jagy Dec 18 '12 at 5:57
• @WillJagy I don't follow. $\|(2,1,0)\|=\sqrt{5}$ is not an integer. – user1551 Dec 18 '12 at 6:08

Well, if your real question is what @user1551 says, then it is probably true in $\mathbb Z^3.$ See the paper I call Pall_Automorphs_1940 at one of my websites, TERNARY. All that is necessary for this to settle dimension 3 is this: If $n$ is odd and $$n^2 = x^2 + y^2 + z^2$$ with $x$ odd, then we can find $a,b,c,d$ such that $$x = a^2 + b^2 - c^2 - d^2, \; \; y = 2(ad - bc), \; \; z = 2(ac+bd)$$ and $$n = a^2 + b^2 + c^2 + d^2.$$ This seems likely to me, and may be in one of Pall's articles. He and Jones found every way to use integral quaternions in studying the sum of three squares.

Other than that, I will need to think about it.

The shortest integral length for which a 3 by 3 such matrix cannot be made symmetric is 39, as in $$\left( \begin{array}{ccc} 29 & 22 & 14 \\ 2 & 19 & -34 \\ -26 & 26 & 13 \end{array} \right) .$$ As the only repeated absolute value is 26, you do not have the three pairs of repeated absolute values necessary for transpositions of rows, or columns, and negation of either to result in symmetry. Actually, I suppose there could be some shorter length where some combinatoric problem prevents symmetry. Hard to tell.

The shortest integral length where you get nine distinct absolute values is 57, as in

$$\left( \begin{array}{ccc} 47 & 28 & 16 \\ 4 & 23 & -52 \\ -32 & 44 & 17 \end{array} \right) .$$

The dimension 3 case is looking very good. I was looking in Dickson's History, volume II, page 271, where he mentions briefly that H. Schubert suggested this in 1902: we consider $4x^2 + 4y^2 + z^2 = n^2$ with $z,n$ odd and $\gcd(n,z) = 1.$ This is not every case but it is a good start. It follows that with $$u = \frac{1}{2}(n-z), \; \; v = \frac{1}{2}(n+z),$$ we also get $\gcd(n,z) = 1.$ Then, from $$uv = x^2 + y^2,$$ we know that the two factors are separately sums of two squares, that is $$v = a^2 + b^2, \; \; u = c^2 + d^2$$ for some $a,b,c,d.$ But this immediately gives $$n = a^2 + b^2 + c^2 + d^2, \; \; z = a^2 + b^2 - c^2 - d^2.$$ That is most of the battle.

FOUND IT. For dimension 3, this is Theorem 3 on page 176 of Jones and Pall (1939) which is on that website, taking $\lambda = 1.$ So dimension 3 is affirmative.

Dimension 4 is also affirmative, because you may begin with any quaternion $t$ and make the evident matrix out of $t,it,jt,kt.$

However, I do not see why that says anything about dimension 6. Given a row of six integers, certainly a rearrangement of pairs, with one extra minus sign for each pair, gives an orthogonal row. I don't see what to do after that. It is always possible that the octonions give some method for dimensions 5,6,7,8, but I would not be too sure about dimension 9 and above.

• This is very helpful. Thank you! I'll need some time to go through the references to make sense of it, but I greatly appreciate the help. – Mark R. Dec 19 '12 at 8:01
• You're right about higher even dimensions. I was too quick to generalize. – Mark R. Dec 19 '12 at 8:05
• In fact, $\left<3,2,1,1,1\right>$ gives a counter example for $n=5$. – Mark R. Dec 19 '12 at 8:47
• @MarkR., good to know about dimension 5. In the first mentioned article, the 3 by 3 matrix is formula (10) on page 755. I switched from $t_0, t_1, t_2, t_3$ to $a,b,c,d.$ The other paper says that matrix (10) actually covers everything. – Will Jagy Dec 19 '12 at 9:26
• No, I take that back. I need to stop posting at 2 a.m. $\left< 3,2,1,1,1\right>$ is not a counter example for $n=5$. I'd neglected the vector $\left<-2,0,2,2,2 \right>$: $\left<3,2,1,1,1\right>, \left<-1,2,-3,1,1\right>, \left<-1,2,1,-3,1\right>, \left<-1,2,1,1,-3\right>, \left<-2,0,2,2,2\right>$. – Mark R. Dec 19 '12 at 14:57

EDIT: This is true up to dimension 8. An article that I have, Hsia, J.S. Two theorems on integral matrices. Linear Multilinear Algebra 5, 257-264 (1978). I put a pdf at TERNARY with the name Hsia_1978.pdf. He calls the the Completion problem, answers it in Theorem 2. He also gives my dimension 9 example, page 262. So, I was only about 34 years late. This reference was provided on MO by someone anonymous using the name http://en.wikipedia.org/wiki/Yazdegerd_III , which I really thought was a Dr. Seuss name because of the rhyme, compare http://en.wikipedia.org/wiki/Yertle_the_Turtle_and_Other_Stories and see http://en.wikipedia.org/wiki/Dr._Seuss_bibliography#Dr._Seuss_books

ORIGINAL: Finally got it. The task is impossible for a 9 by 9 matrix with first row $$(1,1,1,1,1,1,1,1,1 ).$$

I Win.

The trick is that $$x^2 \equiv x \pmod 2.$$ So, if I take any ODD number $k,$ and consider a $k^2$ by $k^2$ matrix, then take the first row of the matrix to be all 1's, we find that there are NO other rows of the same length orthogonal to the first row, because a row $(x_1, \ldots, x_{k^2})$ is required to have squared length $k^2$ in this problem, so $$\sum_{j=1}^{k^2} \; x_j^2 \; = \; k^2 \equiv 1 \pmod 2.$$ Then the dot product with the row of all 1's is $$\sum_{j=1}^{k^2} \; x_j \; \equiv \; \sum_{j=1}^{k^2} \; x_j^2 \equiv 1 \pmod 2.$$ That is, the dot product is odd and therefore nonzero. So, in fact, there are just no orthogonal rows of the same squared length, you cannot fill in the entire matrix, you cannot even get a second row.

EDIT: a similar thing can be done for any $n$ by $n$ matrix when $$n \equiv 1 \pmod 8.$$ So, for example, when $n = 17,$ the matrix cannot be filled in as desired when the first row is $$(3,1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1).$$ The entries do not need to be 1, just odd. So, there should be infinitely many first rows (for each $n$) for which this task is impossible, as long as we have $n \equiv 1 \pmod 8.$ Yes, that is quite easy. Gauss showed that every number is the sum of three triangular numbers, such being $(1/2)(p^2 +p)$ for integer $p \geq 0.$ Now, $8 \cdot (1/2)(p^2 +p)= 4 p^2 + 4 p.$ So we can represent any multiple of 8 as $4 p^2 + 4 p + 4 q^2 + 4 q + 4 r^2 + 4 r$ with integers $p,q,r \geq 0.$ As a result, we may have any odd square we like (no smaller than $n$) as the sum of the squares of $$(2p+1,2q+1,2r+1,1,1,1, \ldots, 1,1,1,1)$$ with the row being of length $n \equiv 1 \pmod 8.$ As a result, we can have the length be any odd integer we like, as long as it is at least $\lceil \; \sqrt n \; \rceil.$

EDDDITTT: the part about Gauss and triangular numbers says something stronger, making for far more counterexamples: with $n \equiv 1 \pmod 8,$ we may specify any $n-3$ odd numbers we like, then use the final three positions (also odd numbers) to force integral length, as requested in the original problem. Hence this example: $$(1,3,5,7,9,11,13,17,25)$$ which has length 37. But any other integer vector of length 37 has an odd, hence nonzero, inner product with this vector.

This answer is wrong. And let it remain there as a reminder for me.

Some thoughts: For any integer $N \times 1$ vector , you can find another $N-1$ orthogonal set of vectors in the rational field. This is always true. Since it is in the rational field, you can multiply by a large integer, and make them all have integer entries.

Now we have seen that for every integer vector, you can find a integer orthogonal basis. But we have neglected the length part.

Let us say you have two integer vectors $\vec{x}$ and $\vec{y}$. Then there always exist a positive number $c_1$ and another positive number $c_2$ such that $c_1||\vec{x}||=c_2||\vec{y}||$. I think this should be true for any number of integer vectors. If that is true, then you can past the length part also.

• I agree, though after all the scaling required to make elements integer and vectors equal in length the resultant matrix would have a large determinant, thus would be a lattice of low density in $\mathbb{Z}_n$ – adam W Dec 18 '12 at 5:48
• Learning to forgive yourself is the beginning of humanity. – Will Jagy Dec 18 '12 at 5:55
• You're braver than I am; I'd happily erase evidence of the original poor phrasing of my question if I could. But often the logical work required to figure out what is incorrect is productive. Anyway, reading this helped me. – Mark R. Dec 19 '12 at 7:49

No, in fact, to extend $(a_1,\cdots,a_n)$ to a basis of $\mathbb{Z}^n$ a necessary and sufficient condition is that $\text{gcd}(a_1,\cdots,a_n)=1$. To see necessity, suppose for a second that $(a_1,\cdots,a_n)=x_1$ extends to a basis $\{x_1,\cdots,x_n\}$ for $\mathbb{Z}^n$. We know then that the matrix

$$A=\left(\begin{array}{c|c|c} & & \\ x_1 & \cdots & x_n\\ & & \end{array}\right)$$

is in $\text{GL}_n(\mathbb{Z})$ so that $\det(A)=\pm 1$. But, by expanding along the first column you find that

$$\pm1=\det(A)=m_1 a_1+\cdots +m_n a_n$$

so that $\text{gcd}(a_1,\cdots,a_n)$ is $1$ as desired. So, taking $(0,0,2)$ which has integer length, but can't be extended to a basis, let alone an orthogonal one.

• What about an orthogonal basis, as mentioned by OP? – user27126 Dec 18 '12 at 4:54
• @Sanchez Unless I'm being horribly dense, I think I've shown that you can't extend it to ANY basis, let alone a orthogonal one. – Alex Youcis Dec 18 '12 at 4:55
• I meant to ask what a necessary and sufficient condition for a possible extension of one vector to an orthogonal basis would be. I doubt that entries being coprime would be enough. – user27126 Dec 18 '12 at 4:57
• @Sanchez Good question, I will think about this. – Alex Youcis Dec 18 '12 at 4:57
• one doubt. Isn't $[2,0,0]$, $[0,2,0]$, $[0,0,2]$ an orthogonal basis of with all vectors having same length – dineshdileep Dec 18 '12 at 5:12

Computer program for size 5, which seems to hold up as well as 3,4. No idea why.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

#include <iostream>
#include <stdlib.h>
#include <fstream>
#include <strstream>
#include <list>
#include <set>
#include <math.h>
#include <iomanip>
#include <string>
#include <algorithm>
#include <iterator>

using namespace std;

// compile as
//        g++ -o size_5  size_5.cc -lm

// then run with

//   ./size_5

const int ENTRY_BOUND = 6   ;

class  vex5
{

friend ostream & operator<< (ostream &, const vex5 &);

public:
vex5();
vex5(int,int,int,int,int);
void setFields(int,int,int,int,int);
int GetV() const;
int GetW() const;
int GetX() const;
int GetY() const;
int GetZ() const;

int  operator ==  ( const vex5 & ) const;
int  operator <  ( const vex5 & ) const;
int Norm() const;
int Dot(const vex5 &) const;

private:
int v;
int w;
int  x;
int  y;
int  z;
} ;

vex5::vex5()
{
setFields(0,0,0,0,0) ;
}

vex5::vex5(int v1, int w1,int x1, int y1, int z1)
{
setFields(v1, w1, x1,y1,z1) ;
}

void vex5::setFields(int v1, int w1, int x1, int y1, int z1)
{
v = v1; w = w1;   x = x1 ; y = y1 ; z = z1 ;
}

int vex5::Norm() const
{
return v * v + w * w + x * x + y * y + z * z;
}

int vex5::Dot(const vex5 & right) const
{
return v * right.v + w *  right.w + x *  right.x + y *  right.y + z *  right.z;
}

int vex5::GetV() const
{
return v;
}

int vex5::GetW() const
{
return w;
}

int vex5::GetX() const
{
return x;
}

int vex5::GetY() const
{
return y;
}

int vex5::GetZ() const
{
return z;
}

int  vex5::operator ==  ( const vex5 & right) const
{
return v == right.v && w == right.w && x == right.x && y == right.y && z == right.z ;
}

int  vex5::operator <  ( const vex5 & right) const
{
int boo ;

boo = (v < right.v) ;
boo = boo || ( (v == right.v) && ( w < right.w ) ) ;
boo = boo || ( (v == right.v) && ( w == right.w ) && (x < right.x)) ;
boo = boo || ( (v == right.v) && ( w == right.w ) && (x == right.x) && (y < right.y)) ;
boo = boo || ( (v == right.v) && ( w == right.w ) && (x == right.x) && (y == right.y)  && (z < right.z)) ;
return boo ;
}

ostream & operator<< (ostream & output, const vex5 & h)
{
// output << setiosflags(ios::left) ;
output << setw(6) << h.v ;  // Disc <2,000,000: a < 100
output << setw(6) << h.w ;  // Disc <2,000,000: b < 1000
output << setw(6) << h.x ;  // Disc <2,000,000: c < 1000000
output << setw(6) << h.y ;  // Disc <6,013,006: d > -1000
output << setw(6) << h.z ;  // { 2, n+1, n+1, -n, 1, 1 }
return output; // Deitel and Deitel page 445
}

int IntSqrt(int i)
{
// cerr << "called intsqrt  with   " << i << endl;
if ( i <= 0 ) return 0;
else if ( i <= 3) return 1;
else if ( i >= 2147395600) return 46340;
else
{
float r;
r = 1.0 * i;
r = sqrt(r);
int root = (int) ceil(r);
while ( root * root   <= i ) ++root;
while ( root * root   > i ) --root;
return  root ;
}
}

int SquareQ(int i)
{
if ( i < 0 ) return 0;
else if ( i <= 1) return 1;
else
{
int root = IntSqrt(i);
return i == root * root ;
}
}

int main()
{

//        g++ -o size_5  size_5.cc -lm

int keepgoing = 1;

for( int a = 1; keepgoing &&  a <= ENTRY_BOUND; ++a){
for( int b = 0; keepgoing &&   b <= a; ++b) {
for( int c = 0;  keepgoing &&  c <= b; ++c) {
for( int d = 0; keepgoing &&   d <= c; ++d) {
for( int e = 0;  keepgoing &&  e <= d; ++e) {

vex5 given(a,b,c,d,e);

int norm = given.Norm();
//   cout << norm << endl << endl;

if (  SquareQ( norm))
{
set<vex5> smegma;
int root = IntSqrt(norm) ;
cout << setw(12) << norm << setw(12) << root << endl << endl;

for(int v = -root; v <= root; ++v){
for(int w = -root; w <= root; ++w){
for(int x = -root; x <= root; ++x){
for(int y = -root; y <= root; ++y){
for(int z = -root; z <= root; ++z){

vex5 spooge(v,w,x,y,z);
if( norm == spooge.Norm() && 0 == spooge.Dot(given)   )    smegma.insert(spooge) ;

}}}}}  // for  vwxyz

// int a_bound = IntSqrt(n);

int boo = 1;
set<vex5>::iterator it1;
set<vex5>::iterator it2;
set<vex5>::iterator it3;
set<vex5>::iterator it4;

for(it1 = smegma.begin() ; boo && it1 != smegma.end() ; ++it1)
{

vex5 u = *it1;
for(it2 = it1 ; boo && it2 != smegma.end() ; ++it2)
{
vex5 v = *it2;
//  cout << setw(8) << u << setw(8) << v << endl;
if ( 0 == v.Dot(u)   )
{
for(it3 = it2 ; boo && it3 != smegma.end() ; ++it3)
{
vex5 w = *it3;
if ( 0 == w.Dot(u) &&   0 == w.Dot(v)  )
{
for(it4 = it3 ; boo && it4 != smegma.end() ; ++it4)
{
vex5 x = *it4;
if ( 0 == x.Dot(u) &&   0 == x.Dot(v)  &&   0 == x.Dot(w)  )
{
boo = 0;
cout << given << endl;
cout << u << endl;
cout << v << endl;
cout << w << endl;
cout << x << endl;
cout << endl;
} // if success
} // for it4
}  // if w perp u,v
} // for it3
}  // if u perp v
}  // for it2
}   // for it1

cout << endl << endl;
if(boo){
cout << "FAILURE" << given << endl << endl;
keepgoing = 0;
} // if failure
} // if norm is squre
}}}}}  // for abcde
//        g++ -o size_5  size_5.cc -lm

return 0 ;
}


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

           1           1

1     0     0     0     0
0    -1     0     0     0
0     0    -1     0     0
0     0     0    -1     0
0     0     0     0    -1

4           2

1     1     1     1     0
-1    -1     1     1     0
-1     1    -1     1     0
-1     1     1    -1     0
0     0     0     0    -2

4           2

2     0     0     0     0
0    -2     0     0     0
0     0    -2     0     0
0     0     0    -2     0
0     0     0     0    -2

9           3

2     2     1     0     0
-2     1     2     0     0
-1     2    -2     0     0
0     0     0    -3     0
0     0     0     0    -3

16           4

2     2     2     2     0
-3     1     1     1    -2
-1    -1    -1     3     2
-1    -1     3    -1     2
-1     3    -1    -1     2

9           3

3     0     0     0     0
0    -3     0     0     0
0     0    -3     0     0
0     0     0    -3     0
0     0     0     0    -3

16           4

3     2     1     1     1
-2     0     2     2     2
-1     2    -3     1     1
-1     2     1    -3     1
-1     2     1     1    -3

25           5

3     2     2     2     2
-2    -3     2     2     2
-2     2    -3     2     2
-2     2     2    -3     2
-2     2     2     2    -3

36           6

3     3     3     3     0
-5     1     1     3     0
-1    -1     5    -3     0
-1     5    -1    -3     0
0     0     0     0    -6

16           4

4     0     0     0     0
0    -4     0     0     0
0     0    -4     0     0
0     0     0    -4     0
0     0     0     0    -4

25           5

4     2     2     1     0
-2    -1     4     2     0
-2     4    -1     2     0
-1     2     2    -4     0
0     0     0     0    -5

25           5

4     3     0     0     0
-3     4     0     0     0
0     0    -5     0     0
0     0     0    -5     0
0     0     0     0    -5

36           6

4     3     3     1     1
-4     1     3     1     3
-2     4     0     0    -4
0    -3     3     3    -3
0    -1     3    -5    -1

36           6

4     4     2     0     0
-4     2     4     0     0
-2     4    -4     0     0
0     0     0    -6     0
0     0     0     0    -6

49           7

4     4     3     2     2
-5     0     4     2     2
-2     4    -2    -4     3
-2     4    -2     3    -4
0    -1    -4     4     4

49           7

4     4     4     1     0
-5     2     2     4     0
-2    -2     5    -4     0
-2     5    -2    -4     0
0     0     0     0    -7

64           8

4     4     4     4     0
-6     2     2     2    -4
-2    -2    -2     6     4
-2    -2     6    -2     4
-2     6    -2    -2     4

25           5

5     0     0     0     0
0    -5     0     0     0
0     0    -5     0     0
0     0     0    -5     0
0     0     0     0    -5

36           6

5     3     1     1     0
-3     3     3     3     0
-1     3    -5     1     0
-1     3     1    -5     0
0     0     0     0    -6

49           7

5     4     2     2     0
-4     1     4     4     0
-2     4    -5     2     0
-2     4     2    -5     0
0     0     0     0    -7

64           8

5     5     3     2     1
-5     3     5    -2    -1
-3     5    -5     2     1
-2    -2     2     4     6
-1    -1     1     6    -5

100          10

5     5     5     4     3
-8     0     4     2     4
-3     5    -1     4    -7
-1     5    -7     0     5
-1     5     3    -8    -1

100          10

5     5     5     5     0
-8     0     4     4    -2
-3     5    -1    -1     8
-1     5    -7     3    -4
-1     5     3    -7    -4

36           6

6     0     0     0     0
0    -6     0     0     0
0     0    -6     0     0
0     0     0    -6     0
0     0     0     0    -6

49           7

6     2     2     2     1
-3     2     4     4    -2
-2     3     0     0     6
0    -4    -2     5     2
0    -4     5    -2     2

49           7

6     3     2     0     0
-3     2     6     0     0
-2     6    -3     0     0
0     0     0    -7     0
0     0     0     0    -7

64           8

6     3     3     3     1
-4     2     2     2     6
-2    -1    -1     7    -3
-2    -1     7    -1    -3
-2     7    -1    -1    -3

64           8

6     4     2     2     2
-5     6     1     1     1
-1    -2    -3     5     5
-1    -2     5    -3     5
-1    -2     5     5    -3

81           9

6     4     4     3     2
-6     0     5     4     2
-3     8    -2    -2     0
0    -1     0    -4     8
0     0    -6     6     3

100          10

6     4     4     4     4
-8     3     3     3     3
0    -7    -1     1     7
0    -5     5     5    -5
0    -1     7    -7     1

64           8

6     5     1     1     1
-4     6    -2    -2    -2
-2     1    -3     5     5
-2     1     5    -3     5
-2     1     5     5    -3

81           9

6     5     4     2     0
-6     2     4     5     0
-3     6     0    -6     0
0    -4     7    -4     0
0     0     0     0    -9

81           9

6     6     2     2     1
-6     3     4     4     2
-3     6    -4    -4    -2
0     0    -6     3     6
0     0    -3     6    -6

81           9

6     6     3     0     0
-6     3     6     0     0
-3     6    -6     0     0
0     0     0    -9     0
0     0     0     0    -9

121          11

6     6     6     3     2
-8     1     4     2     6
-4     2     4     2    -9
-2     8    -7     2     0
-1     4     2   -10     0

144          12

6     6     6     6     0
-10     2     2     6     0
-2    -2    10    -6     0
-2    10    -2    -6     0
0     0     0     0   -12

169          13

6     6     6     6     5
-11     2     2     2     6
-2    -5     2    10    -6
-2     2    10    -5    -6
-2    10    -5     2    -6


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

• I ran it with ENTRY_BOUND = 16; it took a couple of hours, output is 4810 lines. – Will Jagy Dec 20 '12 at 6:36