login
1/12 of the number of integer quadruples with sum = 3*n and sum of squares = 7*n^2.
7

%I #27 Sep 20 2020 08:20:39

%S 1,1,4,0,4,4,6,0,12,4,10,0,14,6,16,0,16,12,19,0,24,10,22,0,20,14,36,0,

%T 30,16,32,0,40,16,24,0,38,19,56,0,42,24,42,0,48,22,46,0,42,20,64,0,54,

%U 36,40,0,76,30,60,0,60,32,72,0,56,40,68,0,88,24,72,0,72,38,80,0,60,56,80,0,108,42,82,0,64,42,120,0,90,48,84,0,128,46,76,0,98,42,120,0

%N 1/12 of the number of integer quadruples with sum = 3*n and sum of squares = 7*n^2.

%C Conjecture: a(n) is multiplicative with a(2) = 1, a(2^k) = 0 for k >= 2, and for k >= 1 and p an odd prime, a(p^k) = p^(k-1)*a(p) with a(p) = p + 1 for p == (2, 3, 8, 10, 12, 13, 14, 15, 18) (mod 19), a(p) = p - 1 for p == (1, 4, 5, 6, 7, 9, 11, 16, 17) (mod 19), and p(19) = 19. It would be nice to have a proof of this.

%C This sequence applies also to the case sum = n and ssq = 5*n^2.

%H Andrew Howroyd, <a href="/A278086/b278086.txt">Table of n, a(n) for n = 1..500</a>

%H Petros Hadjicostas, <a href="/A278081/a278081.r.txt">Slight modification of Mallows' R program</a>. [To get the total counts for n = 1 to 120, type gc(1:120, 3, 7), where r = 3 and s = 7. To get the 1/12 of these counts, type gc(1:120, 3, 7)[,3]/12. As stated in the comments, we get the same sequence with r = 1 and s = 5, i.e., we may type gc(1:120, 1, 5)[,3]/12.]

%H Colin Mallows, <a href="/A278081/a278081_2.txt">R programs for A278081-A278086</a>.

%e For the case r = 3 and s = 7, we have 12*a(3) = 48 because of (-3,2,5,5) and (-1,-1,5,6) (12 permutations each) and (-2,1,3,7) (24 permutations). For example, (-3) + 2 + 5 + 5 = 9 = 3*3 and (-3)^2 + 2^2 + 5^2 + 5^2 = 63 = 7*3^2.

%e For the case r = 1 and s = 5, we again have 12*a(3) = 48 because of (3,3,3,3) - (-3,2,5,5) = (6,1,-2,-2) and (3,3,3,3) - (-1,-1,5,6) = (4,4,-2,-3) (12 permutations each) and (3,3,3,3) - (-2,1,3,7) = (5,2,0,-4) (24 permutations). For example, 5 + 2 + 0 + (-4) = 3 = 1*3 and 5^2 + 2^2 + 0^2 + (-4)^2 = 45 = 5*3^2.

%t sqrtint = Floor[Sqrt[#]]&;

%t q[r_, s_, g_] := Module[{d = 2 s - r^2, h}, If[d <= 0, d == 0 && Mod[r, 2] == 0 && GCD[g, r/2] == 1, h = Sqrt[d]; If[IntegerQ[h] && Mod[r+h, 2] == 0 && GCD[g, GCD[(r+h)/2, (r-h)/2]]==1, 2, 0]]] /. {True -> 1, False -> 0};

%t a[n_] := Module[{s}, s = 7 n^2; Sum[q[3 n - i - j, s - i^2 - j^2, GCD[i, j]], {i, -sqrtint[s], sqrtint[s]}, {j, -sqrtint[s - i^2], sqrtint[s - i^2]}]/12];

%t Table[an = a[n]; Print[n, " ", an]; an, {n, 1, 100}] (* _Jean-François Alcover_, Sep 20 2020, after _Andrew Howroyd_ *)

%o (PARI)

%o q(r, s, g)={my(d=2*s - r^2); if(d<=0, d==0 && r%2==0 && gcd(g, r/2)==1, my(h); if(issquare(d, &h) && (r+h)%2==0 && gcd(g, gcd((r+h)/2, (r-h)/2))==1, 2, 0))}

%o a(n)={my(s=7*n^2); sum(i=-sqrtint(s), sqrtint(s), sum(j=-sqrtint(s-i^2), sqrtint(s-i^2), q(3*n-i-j, s-i^2-j^2, gcd(i,j)) ))/12} \\ _Andrew Howroyd_, Aug 02 2018

%Y Cf. A046897, A278081, A278082, A278083, A278084, A278085.

%K nonn

%O 1,3

%A _Colin Mallows_, Nov 14 2016

%E Example section edited by _Petros Hadjicostas_, Apr 21 2020