Notes on A107006
----------------
Date: Wed, 23 Apr 2008 21:20:23 -0600
From: Don Reble <djr(AT)nk.ca>


    A107006 is primes of the form 4x^2-4xy+7y^2, with x and y nonnegative.
    We ponder whether this could be renamed, primes of the form 24k+7.
    Call this second set A2.

    It's easy to show that A107006 is a subset of A2. (This is
    essentially what Artur did.) Simply observe that, modulo 24,
    4x^2-4xy+7y^2 has the range {0, 4, 7, 12, 15, 16}.
    Of these, only 24k+7 numbers can be prime.

    The hard part is, to show that A2 is a subset of A107006.


    First, observe that 4x^2-4xy+7y^2 = (2x-y)^2 + 6y^2.
    Let w = 2x-y.

    Let p be any 24k+7 prime. Then (by quadratic reciprocity), -6 is
    a quadratic residue, modulo p. Let r^2 == -6 mod p.

    Using Farey sequences (see Hardy&Wright, theorem 36), one can show
    that (for any real s, integer n>1) there is an integer z, and
    an integer y, 0<y<n, such that such that abs(s - z/y) <= 1/(yn).
    Letting n = ceil(sqrt(p)), s=r/p, we have
	0 < y < sqrt(p),
	abs(r/p - z/y) <= 1/(yn) < 1/(y sqrt(p)).
    Multiply by py:
	abs(ry - zp) < p/sqrt(p) = sqrt(p).
    Let w = ry - zp.

	w^2 = (ry - zp)^2 == (r^2 y^2) mod p == -6 y^2 mod p.
	w^2 + 6y^2 = 0 mod p.
    So some multiple of p is representable as w^2 + 6y^2. Also,
	abs(ry - zp) < sqrt(p), so 0 <= w^2 < p;
	0 < y < sqrt(p), so 0 < y^2 < p,
	0 < w^2 + 6y^2 < 7p.

    --- One of {p, 2p, 3p, 4p, 5p, 6p} is representable as w^2 + 6y^2. ---

    Modulo 24, the range of w^2 + 6y^2 is
    {0, 1, 4, 6, 7, 9, 10, 12, 15, 16, 18, 22}.
    But (2p, 3p, 5p) == (14, 21, 11) mod 24; these numbers have no
    representation.

    --- One of {p, 4p, 6p} is representable as w^2 + 6y^2. ---

    If 4p = w^2 + 6y^2, then w is even; w^2 is a multiple of 4; 6y^2 is
    a multiple of 4; y^2 is even; y is even. Since both w and y are even,
    p = (w/2)^2 + 6(y/2)^2.

    If 6p = w^2 + 6y^2, then w^2 is a multiple of 6; and w is a multiple
    of 6, say 6v. So p = y^2 + 6v^2.

    In all three cases:

    --- p is representable as w^2 + 6y^2. ---

    We can choose w and y to be non-negative. w is not zero, because p
    is not divisible by 6; y is not zero, because p is not a square.
    Therefore w and y are positive.

    Since p = w^2 + 6y^2, w is odd; and w^2 is 1 mod 4.
    p is 3 mod 4, so 6y^2 = 2 mod 4, not a multiple of 4.
    Therefore y is odd.

    Since w and y are odd positives, (w+y)/2 = x is a positive integer;
    and p = 4x^2-4xy+7y^2. That shows that A2 is a subset of A107006,
    and the sequences are equal.