cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-4 of 4 results.

A278085 1/4 of the number of primitive integral quadruples with sum = 3*n and sum of squares = 3*n^2.

Original entry on oeis.org

1, 1, 3, 0, 6, 3, 6, 0, 9, 6, 12, 0, 12, 6, 18, 0, 18, 9, 18, 0, 18, 12, 24, 0, 30, 12, 27, 0, 30, 18, 30, 0, 36, 18, 36, 0, 36, 18, 36, 0, 42, 18, 42, 0, 54, 24, 48, 0, 42, 30, 54, 0, 54, 27, 72, 0, 54, 30, 60, 0, 60, 30, 54, 0, 72, 36, 66, 0, 72, 36, 72, 0, 72, 36, 90, 0, 72, 36, 78, 0, 81, 42, 84, 0, 108, 42, 90, 0, 90, 54, 72, 0, 90, 48, 108, 0, 96, 42, 108, 0
Offset: 1

Views

Author

Colin Mallows, Nov 14 2016

Keywords

Comments

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 == 5 (mod 6), a(p) = p-1 for p=1 (mod 6), and a(3) = 3. It would be nice to have a proof of this. [See A354766 for additional conjectures. - N. J. A. Sloane, Jun 19 2022]
This is also 1/4 of the number of primitive integral quadruples with sum = n and sum of squares = n^2. See A354766, A354777, A354778 for the total number of solutions. - N. J. A. Sloane, Jun 27 2022

Examples

			For the case r = s = 3, we have 4*a(3) = 12 because of (1,1,3,4) (12 permutations). Indeed, 1 + 1 + 3 + 4 = 9 = 3*3 and 1^2 + 1^2 + 3^2 + 4^2 = 27 = 3*3^2.
For the case r = s = 1, we have again 4*a(3) = 12 because of (3,3,3,3) - (1,1,3,4) = (2,2,0,-1) (12 permutations). Indeed, 2 + 2 + 0 + (-1) = 3 = 1*3 and 2^2 + 2^2 + 0^2 + (-1)^2 = 9 = 1*3^2.
		

Crossrefs

Programs

  • Mathematica
    sqrtint = Floor[Sqrt[#]]&;
    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};
    a[n_] := Module[{s}, s = 3 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]}]/4];
    Table[an = a[n]; Print[n, " ", an]; an, {n, 1, 100}] (* Jean-François Alcover, Sep 20 2020, after Andrew Howroyd *)
  • PARI
    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))}
    a(n)={my(s=3*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)) ))/4} \\ Andrew Howroyd, Aug 02 2018

Extensions

Example edited by Petros Hadjicostas, Apr 21 2020

A354766 1/4 of the total number of integral quadruples with sum = n and sum of squares = n^2.

Original entry on oeis.org

1, 2, 4, 2, 7, 8, 7, 2, 13, 14, 13, 8, 13, 14, 28, 2, 19, 26, 19, 14, 28, 26, 25, 8, 37, 26, 40, 14, 31, 56, 31, 2, 52, 38, 49, 26, 37, 38, 52, 14, 43, 56, 43, 26, 91, 50, 49, 8, 49, 74, 76, 26, 55, 80, 91, 14, 76, 62, 61, 56, 61, 62, 91, 2, 91, 104, 67, 38, 100, 98, 73, 26, 73, 74, 148, 38, 91, 104, 79, 14, 121, 86, 85, 56
Offset: 1

Views

Author

N. J. A. Sloane, Jun 19 2022, based on an email from Colin Mallows, Jun 12 2022

Keywords

Comments

If instead we count only primitive quadruples (meaning quadruples (h,i,j,k) with gcd(h,i,j,k) = 1) we get A278085(n).
Conjectures from Colin Mallows, Jun 12 2022: (Start)
Given a natural number n, a "quad" for n is a quadruple q = (h,i,j,k) of integers with sum(q) = h+i+j+k = n and sum(q^2) = h^2+i^2+j^2+k^2 = n^2.
A quad q is "primitive" if gcd(h,i,j,k) = 1. Define pq(n) = A278085(n) to be the number of distinct primitive quads for n, and tq(n) (the present sequence) to be the total number of quads for n.
Conjecture 1: (Based on the data for n <= 5000) pq/4 and tq/4 are multiplicative sequences.
Conjecture 2: When n = p^k, p prime and k >= 1:
if p = 2, k = 1 then pq(q)/4 = 1 and tq(n)/4 = 2;
if p = 2, k >= 2 then pq(q)/4 = 0 and tq(n)/4 = 2;
if p = 3, k >= 1 then pq(q)/4 = n and tq(n)/4 = (3*n-1)/2;
if p == 5 (mod 6), k >= 1 then pq(q)/4 = (p+1)*n/p and tq(n)/4 = n + 2*(n-1)/(p-1);
if p == 1 (mod 6), k >= 1 then pq(q)/4 = (p-1)*n/p and tq(n)/4 = n.
(End)
Conjecture: the numbers n for which a(n) = n have a positive asymptotic density.

Examples

			Solutions for n = 1: (1,0,0,0) and all permutations thereof.
n=2: (2,0,0,0) and (1,1,1,-1).
n=3: (3,0,0,0) and (2,2,-1,0).
n=4: (4,0,0,0) and (2,2,2,-2). Eight solutions, so a(4) = 8/4 = 2. None are primitive, so A278085(4) = 0.
n=5: (5,0,0,0) and (4,2,-2,1). 4+24 solutions, so a(5) = 28/4 = 7. 24 are primitive, so A278085(5) = 24/4 = 6.
		

Crossrefs

See also A353589 (counts nondecreasing nonnegative (h,i,j,k) such that (+-h, +-i, +-j, +-k) is a solution).

Programs

  • Maple
    f:= proc(n) local d; add(g3(n-d, n^2 - d^2), d=-n .. n)/4 end proc:
    g3:= proc(x,y) option remember; local m,c;
       if x^2 > 3*y then return 0 fi;
       m:= floor(sqrt(y));
       add(g2(x-c,y - c^2), c=- m.. m)
    end proc:
    g2:= proc(x,y) option remember;
       local v;
       v:= 2*y - x^2;
       if not issqr(v) then 0
       elif v = 0 then 1
       else 2
       fi
    end proc:
    map(f, [$1..100]); # Robert Israel, Feb 16 2023
  • Mathematica
    f[n_] := Sum[g3[n - d, n^2 - d^2], {d, -n, n}]/4 ;
    g3[x_, y_] := g3[x, y] = Module[{m}, If[x^2 > 3*y, 0, m = Floor[Sqrt[y]]; Sum[g2[x - c, y - c^2], {c, -m, m}]]];
    g2[x_, y_] := g2[x, y] = Module[{v}, v = 2*y - x^2; Which[!IntegerQ@Sqrt[v], 0, v == 0, 1, True, 2]];
    f /@ Range[100] (* Jean-François Alcover, Mar 09 2023, after Robert Israel *)

A354778 Number of integer quadruples (u,v,w,x) such that u^2+v^2+w^2+x^2 = n^2 and u+v+w+x = n.

Original entry on oeis.org

1, 4, 8, 16, 8, 28, 32, 28, 8, 52, 56, 52, 32, 52, 56, 112, 8, 76, 104, 76, 56, 112, 104, 100, 32, 148, 104, 160, 56, 124, 224, 124, 8, 208, 152, 196, 104, 148, 152, 208, 56, 172, 224, 172, 104, 364, 200, 196, 32, 196, 296, 304, 104, 220, 320, 364, 56, 304, 248, 244, 224, 244, 248, 364, 8, 364, 416, 268, 152, 400, 392, 292, 104, 292, 296, 592, 152, 364, 416, 316, 56, 484, 344, 340, 224
Offset: 0

Views

Author

N. J. A. Sloane, Jun 27 2022

Keywords

Comments

This has the most natural offset, 0, just as A000118 does. A354766 gives one-quarter of a(n) for n > 0, and A278085 counts primitive solutions.

Crossrefs

a(n) = A354777(n^2,n).

Formula

See A278085 and A354766 for some conjectural formulas.

A307531 a(n) is the greatest sum i + j + k + l where i^2 + j^2 + k^2 + l^2 = n and 0 <= i <= j <= k <= l.

Original entry on oeis.org

0, 1, 2, 3, 4, 3, 4, 5, 4, 5, 6, 5, 6, 7, 6, 7, 8, 7, 8, 7, 8, 9, 8, 9, 8, 9, 10, 9, 10, 9, 10, 11, 8, 11, 10, 11, 12, 11, 12, 11, 12, 11, 12, 13, 12, 13, 12, 13, 12, 13, 14, 13, 14, 13, 14, 13, 12, 15, 14, 15, 14, 15, 14, 15, 16, 15, 16, 15, 16, 15, 16, 15
Offset: 0

Views

Author

Rémy Sigrist, Apr 13 2019

Keywords

Comments

The sequence is well defined as every nonnegative integer can be represented as a sum of four squares in at least one way.
It appears that a(n^2) = 2*n if n is even and 2*n-1 if n is odd. - Robert Israel, Apr 14 2019

Examples

			For n = 34:
- 34 can be expressed in 4 ways as a sum of four squares:
    i^2 + j^2 + k^2 + l^2   i+j+k+l
    ---------------------   -------
    0^2 + 0^2 + 3^2 + 5^2         8
    0^2 + 3^2 + 3^2 + 4^2        10
    1^2 + 1^2 + 4^2 + 4^2        10
    1^2 + 2^2 + 2^2 + 5^2        10
- a(34) = max(8, 10) = 10.
		

Crossrefs

See A307510 for the multiplicative variant.

Programs

  • C
    See Links section.
  • Maple
    g:= proc(n,k) option remember; local a;
      if k = 1 then if issqr(n) then return sqrt(n) else return -infinity fi fi;
      max(seq(a+procname(n-a^2,k-1),a=0..floor(sqrt(n))))
    end proc:
    seq(g(n,4), n=0..100); # Robert Israel, Apr 14 2019
  • Mathematica
    Array[Max[Total /@ PowersRepresentations[#, 4, 2]] &, 68, 0] (* Michael De Vlieger, Apr 13 2019 *)
Showing 1-4 of 4 results.