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

A345688 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 v.

Original entry on oeis.org

0, 3, 38, 128, 550, 1028, 3254, 6128, 12600, 19624, 41432, 60111, 111656, 154860, 224450, 318556, 517074, 662843, 1012238, 1283975, 1683692, 2131307, 3047040, 3663423, 4862454, 5934995, 7524506, 9033407, 11960318, 13803500, 17895182, 21162944, 25284962, 29539043
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.
A345427(n) = n^2*mu where mu is the mean of the values of 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 A345688(n): return pvariance(n**2*v for u, v, w in (igcdex(x,y) for x in range(1,n+1) for y in range(1,n+1)))

A345428 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+v.

Original entry on oeis.org

1, 4, 7, 12, 15, 22, 23, 32, 33, 38, 41, 54, 41, 54, 55, 60, 65, 64, 47, 70, 53, 60, 69, 102, 47, 36, 35, 22, 41, 70, 47, 80, 13, -4, 15, -8, -49, -22, -49, -46, -53, -36, -141, -32, -57, -76, -63, -66, -205, -298, -275, -252, -289, -298
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
    T:= proc(x,y) option remember; local g,u0,v0,t0,t1,t2;
       g:= igcd(x,y);
       if g > 1 then return procname(x/g,y/g) fi;
       v0:= y^(-1) mod x;
       u0:= (1-y*v0)/x;
       t0:= (v0*x-u0*y)/(x^2+y^2);
       t1:= floor(t0);
       if t0 < t1 + 1/2 then u0+v0 + t1*(y-x)
       else u0+v0 + (t1+1)*(y-x)
       fi
    end proc:
    R:= 1: v:= 1:
    for n from 2 to 100 do v:= v+1+2*add(T(i,n),i=1..n-1); R:= R,v od:
    R; # Robert Israel, Mar 28 2023
  • 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]]//Total, {x, 1, n}, {y, 1, n}];
    Table[Print[n, " ", a[n]]; a[n], {n, 1, 54}] (* Jean-François Alcover, Mar 28 2023 *)
  • Python
    from sympy.core.numbers import igcdex
    def A345428(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))) # Chai Wah Wu, Jun 24 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
Showing 1-3 of 3 results.