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-6 of 6 results.

A345427 For 1<=x<=n, 1<=y<=n, write gcd(x,y) = u*x+v*y with u,v minimal; a(n) = sum of the values of v.

Original entry on oeis.org

1, 3, 5, 8, 10, 14, 15, 20, 21, 24, 26, 33, 27, 34, 35, 38, 41, 41, 33, 45, 37, 41, 46, 63, 36, 31, 31, 25, 35, 50, 39, 56, 23, 15, 25, 14, -6, 8, -5, -3, -6, 3, -49, 6, -6, -15, -8, -9, -78, -124, -112, -100, -118, -122, -133, -109, -110, -139, -127, -117, -237, -166, -185, -218, -171, -215
Offset: 1

Views

Author

N. J. A. Sloane, Jun 22 2021

Keywords

Comments

Minimal means minimize u^2+v^2. We follow Maple, PARI, etc., in setting u=0 and v=1 when x=y.

Crossrefs

Programs

  • Mathematica
    T[x_, y_] := T[x, y] = Module[{u, v}, MinimalBy[{u, v} /. Solve[u^2 + v^2 <= x^2 + y^2 && u*x + v*y == GCD[x, y], {u, v}, Integers], #.# &]];
    a[n_] := a[n] = Sum[T[x, y][[1, 2]], {x, 1, n}, {y, 1, n}];
    Table[Print[n, " ", a[n]]; a[n], {n, 1, 62}] (* Jean-François Alcover, Mar 28 2023 *)
  • Python
    from sympy.core.numbers import igcdex
    def A345427(n): return sum(v for u, v, w in (igcdex(x,y) for x in range(1,n+1) for y in range(1,n+1))) # Chai Wah Wu, Jun 22 2021

A345423 For 1<=x<=n, 1<=y<=n, with gcd(x,y)=1, write 1 = gcd(x,y) = u*x+v*y with u,v minimal; a(n) = sum of the values of u.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 5, 7, 6, 6, 7, 9, 2, 7, 5, 3, 5, 2, -7, 1, -9, -8, -4, 4, -25, -25, -26, -40, -31, -19, -31, -17, -53, -65, -57, -71, -92, -71, -79, -91, -95, -85, -138, -88, -100, -115, -109, -125, -195, -215, -207, -191, -210, -213, -227, -199, -193, -233, -222, -238
Offset: 1

Views

Author

N. J. A. Sloane, Jun 22 2021

Keywords

Comments

Minimal means minimize u^2+v^2. We follow Maple, PARI, etc., in setting u=0 and v=1 when x=y.

Crossrefs

Programs

  • Maple
    mygcd:=proc(a,b) local d,s,t; d := igcdex(a,b,`s`,`t`); [a,b,d,s,t]; end;
    ansu:=[]; ansv:=[]; ansb:=[];
    for N from 1 to 80 do
    tu:=0; tv:=0; tb:=0;
    for x from 1 to N do
    for y from 1 to N do
    if igcd(x,y)=1 then
       tu:=tu + mygcd(x,y)[4];
       tv:=tv + mygcd(x,y)[5];
       tb:=tb + mygcd(x,y)[4] + mygcd(x,y)[5];
    fi;
    od: od:
    ansu:=[op(ansu),tu];
    ansv:=[op(ansv),tv];
    ansb:=[op(ansb),tb];
    od:
    ansu; # the present sequence
    ansv; # A345424
    ansb; # A345425
    # for A345426, A345427, A345428, omit the "igcd(x,y)=1" test
  • Mathematica
    T[x_, y_] := T[x, y] = Module[{u, v}, MinimalBy[{u, v} /. Solve[u^2 + v^2 <= x^2 + y^2 && u*x + v*y == 1, {u, v}, Integers], #.# &]];
    a[n_] := a[n] = Sum[If[GCD[x, y] == 1, T[x, y][[1, 1]], 0], {x, 1, n}, {y, 1, n}];
    Table[Print[n, " ", a[n]]; a[n], {n, 1, 60}] (* Jean-François Alcover, Mar 28 2023 *)
  • Python
    from sympy.core.numbers import igcdex
    def A345423(n): return sum(u for u, v, w in (igcdex(x,y) for x in range(1,n+1) for y in range(1,n+1)) if w == 1) # Chai Wah Wu, Aug 21 2021

A345424 For 1<=x<=n, 1<=y<=n, with gcd(x,y)=1, write 1 = gcd(x,y) = u*x+v*y with u,v minimal; a(n) = sum of the values of v.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 6, 8, 7, 7, 8, 10, 3, 8, 6, 4, 6, 3, -6, 2, -8, -7, -3, 5, -24, -24, -25, -39, -30, -18, -30, -16, -52, -64, -56, -70, -91, -70, -78, -90, -94, -84, -137, -87, -99, -114, -108, -124, -194, -214, -206, -190, -209, -212, -226, -198, -192, -232, -221, -237, -358, -277, -287, -337
Offset: 1

Views

Author

N. J. A. Sloane, Jun 22 2021

Keywords

Comments

Minimal means minimize u^2+v^2. We follow Maple, PARI, etc., in setting u=0 and v=1 when x=y.

Crossrefs

Programs

  • Mathematica
    T[x_, y_] := T[x, y] = Module[{u, v}, MinimalBy[{u, v} /. Solve[u^2 + v^2 <= x^2 + y^2 && u*x + v*y == 1, {u, v}, Integers], #.# &]];
    a[n_] := a[n] = Sum[If[GCD[x, y] == 1, T[x, y][[1, 2]], 0], {x, 1, n}, {y, 1, n}];
    Table[Print[n, " ", a[n]]; a[n], {n, 1, 64}] (* Jean-François Alcover, Mar 28 2023 *)
  • Python
    from sympy.core.numbers import igcdex
    def A345424(n): return sum(v for u, v, w in (igcdex(x,y) for x in range(1,n+1) for y in range(1,n+1)) if w == 1) # Chai Wah Wu, Jun 22 2021

A345425 For 1<=x<=n, 1<=y<=n, with gcd(x,y)=1, write 1 = gcd(x,y) = u*x+v*y with u,v minimal; a(n) = sum of the values of u+v.

Original entry on oeis.org

1, 3, 5, 7, 9, 11, 11, 15, 13, 13, 15, 19, 5, 15, 11, 7, 11, 5, -13, 3, -17, -15, -7, 9, -49, -49, -51, -79, -61, -37, -61, -33, -105, -129, -113, -141, -183, -141, -157, -181, -189, -169, -275, -175, -199, -229, -217, -249, -389, -429, -413, -381, -419, -425, -453, -397
Offset: 1

Views

Author

N. J. A. Sloane, Jun 22 2021

Keywords

Comments

Minimal means minimize u^2+v^2. We follow Maple, PARI, etc., in setting u=0 and v=1 when x=y.

Crossrefs

Programs

  • Mathematica
    T[x_, y_] := T[x, y] = Module[{u, v}, MinimalBy[{u, v} /. Solve[u^2 + v^2 <= x^2 + y^2 && u*x + v*y == 1, {u, v}, Integers], #.# &]];
    a[n_] := a[n] = Sum[If[GCD[x, y] == 1, T[x, y][[1]] // Total, 0], {x, 1, n}, {y, 1, n}];
    Table[Print[n, " ", a[n]]; a[n], {n, 1, 56}] (* Jean-François Alcover, Mar 28 2023 *)
  • Python
    from sympy.core.numbers import igcdex
    def A345425(n): return sum(u+v for u, v, w in (igcdex(x,y) for x in range(1,n+1) for y in range(1,n+1)) if w == 1) # Chai Wah Wu, Jun 24 2021

A345426 For 1<=x<=n, 1<=y<=n, write gcd(x,y) = u*x+v*y with u,v minimal; a(n) = sum of the values of u.

Original entry on oeis.org

0, 1, 2, 4, 5, 8, 8, 12, 12, 14, 15, 21, 14, 20, 20, 22, 24, 23, 14, 25, 16, 19, 23, 39, 11, 5, 4, -3, 6, 20, 8, 24, -10, -19, -10, -22, -43, -30, -44, -43, -47, -39, -92, -38, -51, -61, -55, -57, -127, -174, -163, -152, -171, -176, -188, -165, -167, -197, -186, -177, -298, -228
Offset: 1

Views

Author

N. J. A. Sloane, Jun 22 2021

Keywords

Comments

Minimal means minimize u^2+v^2. We follow Maple, PARI, etc., in setting u=0 and v=1 when x=y.

Crossrefs

Programs

  • Mathematica
    T[x_, y_] := T[x, y] = Module[{u, v}, MinimalBy[{u, v} /. Solve[u^2 + v^2 <= x^2 + y^2 && u*x + v*y == GCD[x, y], {u, v}, Integers], #.# &]];
    a[n_] := a[n] = Sum[T[x, y][[1, 1]], {x, 1, n}, {y, 1, n}];
    Table[Print[n, " ", a[n]]; a[n], {n, 1, 62}] (* Jean-François Alcover, Mar 28 2023 *)
  • Python
    from sympy.core.numbers import igcdex
    def A345426(n): return sum(u for u, v, w in (igcdex(x, y) for x in range(1, n+1) for y in range(1, n+1))) # Chai Wah Wu, Jul 01 2021

A345724 For 1<=x<=n, 1<=y<=n, write gcd(x,y) = u*x+v*y with u,v minimal; a(n) = n^4*s, where s is the population variance of the values of u+v.

Original entry on oeis.org

0, 0, 14, 48, 250, 452, 1578, 2816, 6120, 9556, 20220, 28476, 54596, 75092, 111050, 155120, 253852, 323792, 497054, 624700, 828476, 1049584, 1510824, 1792476, 2397166, 2924432, 3736358, 4469884, 5919800, 6804500, 8811122, 10401536, 12541844, 14621072, 17574850
Offset: 1

Views

Author

Chai Wah Wu, Jun 24 2021

Keywords

Comments

The factor n^4 is to ensure that a(n) is an integer.
A345428(n) = n^2*mu where mu is the mean of the values of u+v.
The population standard deviation sqrt(s) appears to grow linearly with n.

Crossrefs

Programs

  • Python
    from statistics import pvariance
    from sympy.core.numbers import igcdex
    def A345724(n): return pvariance(n**2*(u+v) for u, v, w in (igcdex(x,y) for x in range(1,n+1) for y in range(1,n+1)))
Showing 1-6 of 6 results.