|  | >    1. Find a number of which the square when increased or decreased by 5
>       remains a square.  (All numbers are to be taken to be rational numbers.)
        Letting the middle number be (a/b)^2 where (a,b) = 1,
        this will be solved by finding positive integers a and b
        with (a,b) = 1, and a^2 - 5b^2 and a^2 + 5b^2 both squares.
        Try a = 41, b = 12 to get (31/12)^2, (41/12)^2, (49/12)^2
        which differ by 5.
        
        Dan
 | 
|  | >    2. Generalize.  (Find all sequences of three squares in arithmetic
>       progression.)
        Let the squares be the squares of the three rationals
        x-a, x, and x+b, with the difference between the squares
        being t:
        
        	(x-a)^2 = x^2 - t
        	x^2     = x^2
        	(x+b)^2 = x^2 + t
        
        Solving these for x yields x = (a^2 + b^2) / (2(a-b))
        after which one can solve for t to get t = ab(a+b) / (a-b)
        
        All sequences of three squares of rationals in arithmetic
        progression can be gotten by letting a and b vary over
        pairs of unequal rationals, and computing x and the
        squares as above.  The (rational) difference between the
        squares is t.  (Use a=5/6, b=2/3 to get the example I
        posted in .-1 for t=5.)
        
        Dan
 | 
|  | >    3.  Finds all sequences of four squares in arithmetic progression.
	I've reduced this problem to one of finding rational solutions to:
		t (t-3) (t-4) = a square
	The 'simple' solutions (t = 0, 2, 3, 4, or 6) yield four squares,
	but the distance between them is 0.
	FWIW, once such a t is found, let
		z^2 = (t-3)(t-4)/t
		w = (z+1/z)/2
		b = a * ( 2*w � sqrt( (w-1)*w*(w+3) ))/(w-3)
	Then use a and b in Dan's equations; x^2 + 2*t will also be a square.
 | 
|  |     A classic unsolved problem in number theory is to find a 'perfect box'.
    The sides of this box are integers, as are the diagonals on each face,
    and (if you've gotten that far) the long diagonal is also an integer.
    
    What I read about the problem went like this: "For a perfect box to exist,
    it's necessary that (wx)�, (xy)�, (yz)�, (wz)� are in an arithmetic
    progression.  So find such sequences and then ...."  The book made that
    first step sound so easy!!  There are kudos galore if we crack this nut.
    Anyway, I've massaged "t (t-3) (t-4) = a square" into several other forms,
    
    	(v� - 1 + 1/v�) = a square, (since the above implies r = a square)
    
    	(M^4 - M�N� + N^4) = a square, (letting v = M/N), or
    
    	(M� - N�)� + (M�N)� = a square
    
    This last equation is very similar to the general form of a primitive
    Pythagorean triple, but I can't find a solution yet.  A computer search
    finds no non-trivial solutions for M,N <= 6000.  To improve the search
    time, I considered the equation modulo p (p is not necessarily a prime).
    
    For (M�-N�)�+(M�N)� to equal a square, it must be congruent to a
    quadratic residue of p.  That is, there must be some S such that
    
    	(M�-N�)� + (M�N)� = S� (mod p)
    
    In modulo 4, for example, 0 and 1 are the only two quadratic residues
    (0�=0, 1�=1, 2�=0, 3�=1), so if (M�-N�)�+(M�N)� equals 2 or 3 (mod 4),
    then (M, N) cannot be a solution.  This check can be done quickly with
    a 4x4 table indexed by (M mod 4) and (N mod 4).
    
    The following program makes tables of (M�-N�)�+(M�N)� mod p, writing
    only the entries that are quadratic residues of p.  The patterns are
    interesting.
#include <stdio.h>
float ratio(int x, int y) { float xx = x; float yy = y; return (xx/yy); }
int sqr(int x) { return x*x; }
int gcd(int a, int b)	/* GCD.  gcd(a,0) = a, gcd(0,b) = b */
{ int c = b; while (c) { int t = a % c; a = c; c = t; } return a; }
main()
{
    int d;
    int m;
    for (d = 2; ; d++) {
	int cnt = 0;
	int i;
	int n;
	printf("\nd = %d\n", d);
	for (n = 0; n < d; n++) printf("+--"); printf("+\n");
	for (m = 0; m < d; m++)	{
	    for (n = 0; n < d; n++) {
		int r;
		int v = -1;
		r = (sqr(m*m - n*n) + sqr(m*n)) % d;
		for (i = 0; i < d; i++) if (sqr(i) % d == r) v = r;
		/* Do M,N have a common factor?  Ex: (M,N) = (0,2) (mod 4) */
		/* if (gcd( d, gcd(m,n) ) != 1) v = -1; */
		if (v == -1) printf("   "); else { cnt++; printf("%3d", v); }
	    }
	    printf("|\n");
	}
	for (n = 0; n < d; n++) printf("+--"); printf("+\n");
	printf("d = %d, %d/%d = %f\n", d, cnt, sqr(d), ratio(cnt,sqr(d)));
    }
}
 |