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-10 of 18 results. Next

A345872 Lexicographically earliest sequence of positive integers such that the values A345415(a(n), a(n+1)) are all distinct.

Original entry on oeis.org

1, 1, 2, 3, 5, 7, 5, 8, 11, 13, 11, 18, 23, 13, 15, 13, 21, 19, 21, 23, 18, 31, 19, 30, 37, 30, 41, 39, 23, 25, 34, 43, 28, 43, 41, 43, 45, 37, 35, 37, 50, 47, 38, 41, 54, 61, 52, 61, 59, 57, 55, 53, 64, 53, 70, 53, 76, 37, 69, 49, 66, 73, 71, 69, 71, 73, 75
Offset: 1

Views

Author

Rémy Sigrist, Jun 27 2021

Keywords

Comments

When writing gcd(a(n), a(n+1)) as u*a(n) + v*a(n+1) where u, v are minimal, the u's are all distinct.

Examples

			The table A345415(n, k) begins:
  n\k|  1  2   3   4
  ---+--------------
    1|  0  1   1   1
    2|  0  0  -1   1
    2|  0  1   0  -1
    2|  0  0   1   0
For n = 1:
- we can choose a(1) = 1.
For n = 2:
- we can choose a(2) = 1,
- A345415(a(1), a(2)) = 0.
For n = 3:
- a(3) must be different from 1,
- we can choose a(3) = 2,
- A345415(a(2), a(3)) = 1.
For n = 4:
- a(4) must be different from 1 and from 2,
- we can choose a(4) = 3.
		

Crossrefs

Programs

  • PARI
    See Links section.

A345873 a(n) = A345415(A345872(n), A345872(n+1)).

Original entry on oeis.org

0, 1, -1, 2, 3, -2, -3, -4, 6, -5, 5, 9, 4, 7, -6, -8, -9, 10, 11, -7, -12, 8, -11, -16, 13, -15, -19, -10, 12, 15, 19, -13, 20, -20, 21, 22, 14, -17, 18, 23, 16, 17, -14, -25, 26, -23, 27, -29, -28, -27, -26, 29, -24, -33, 25, 33, -18, 28, -22, 31, -21, -35
Offset: 1

Views

Author

Rémy Sigrist, Jun 27 2021

Keywords

Comments

All terms are distinct.

Examples

			a(3) = A345415(A345872(3), A345872(4)) = A345415(2, 3) = -1.
		

Crossrefs

Programs

  • PARI
    See Links section.

A345417 Table read by upward antidiagonals: Given m, n >= 1, write gcd(prime(m),prime(n)) as d = u*prime(m)+v*prime(n) where u, v are minimal; T(m,n) = u.

Original entry on oeis.org

0, 1, -1, 1, 0, -2, 1, -1, 2, -3, 1, 1, 0, -2, -5, 1, -1, -2, 3, 4, -6, 1, 1, 1, 0, -2, -4, -8, 1, -1, 2, 2, -3, -5, 6, -9, 1, 1, -2, -1, 0, 2, 7, -6, -11, 1, -1, -1, -2, -5, 6, 5, 4, 8, -14, 1, -1, 2, 3, 2, 0, -3, -8, -9, 10, -15, 1, 1, -1, -3, -4, -3, 4, 7, 10, 6, -10, -18
Offset: 1

Views

Author

N. J. A. Sloane, Jun 19 2021

Keywords

Comments

The gcd is 1 unless m=n when it is m; v is given in A345418. Minimal means minimize u^2+v^2. We follow Maple, PARI, etc., in setting u=0 and v=1 when m=n. If we ignore the diagonal, the v table is the transpose of the u table.

Examples

			The u table (this entry) begins:
[0, -1, -2, -3, -5, -6, -8, -9, -11, -14, -15, -18, -20, -21, -23, -26]
[1, 0, 2, -2, 4, -4, 6, -6, 8, 10, -10, -12, 14, -14, 16, 18]
[1, -1, 0, 3, -2, -5, 7, 4, -9, 6, -6, 15, -8, -17, 19, -21]
[1, 1, -2, 0, -3, 2, 5, -8, 10, -4, 9, 16, 6, -6, -20, -15]
[1, -1, 1, 2, 0, 6, -3, 7, -2, 8, -14, -10, 15, 4, -17, -24]
[1, 1, 2, -1, -5, 0, 4, 3, -7, 9, 12, -17, 19, 10, -18, -4]
[1, -1, -2, -2, 2, -3, 0, 9, -4, 12, 11, -13, -12, -5, -11, 25]
[1, 1, -1, 3, -4, -2, -8, 0, -6, -3, -13, 2, 13, -9, 5, 14]
[1, -1, 2, -3, 1, 4, 3, 5, 0, -5, -4, -8, -16, 15, -2, -23]
[1, -1, -1, 1, -3, -4, -7, 2, 4, 0, 15, -14, 17, 3, 13, 11]
[1, 1, 1, -2, 5, -5, -6, 8, 3, -14, 0, 6, 4, -18, -3, 12]
[1, 1, -2, -3, 3, 6, 6, -1, 5, 11, -5, 0, 10, 7, 14, -10]
...
The v table (A345418) begins:
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
[-1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1]
[-2, 2, 1, -2, 1, 2, -2, -1, 2, -1, 1, -2, 1, 2, -2, 2]
[-3, -2, 3, 1, 2, -1, -2, 3, -3, 1, -2, -3, -1, 1, 3, 2]
[-5, 4, -2, -3, 1, -5, 2, -4, 1, -3, 5, 3, -4, -1, 4, 5]
[-6, -4, -5, 2, 6, 1, -3, -2, 4, -4, -5, 6, -6, -3, 5, 1]
[-8, 6, 7, 5, -3, 4, 1, -8, 3, -7, -6, 6, 5, 2, 4, -8]
[-9, -6, 4, -8, 7, 3, 9, 1, 5, 2, 8, -1, -6, 4, -2, -5]
[-11, 8, -9, 10, -2, -7, -4, -6, 1, 4, 3, 5, 9, -8, 1, 10]
[-14, 10, 6, -4, 8, 9, 12, -3, -5, 1, -14, 11, -12, -2, -8, -6]
[-15, -10, -6, 9, -14, 12, 11, -13, -4, 15, 1, -5, -3, 13, 2, -7]
[-18, -12, 15, 16, -10, -17, -13, 2, -8, -14, 6, 1, -9, -6, -11, 7]
...
		

Crossrefs

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

A345434 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^2+v^2.

Original entry on oeis.org

1, 4, 11, 20, 47, 62, 135, 196, 313, 394, 685, 838, 1317, 1578, 1991, 2484, 3573, 4084, 5595, 6410, 7621, 8792, 11505, 12710, 15539, 17536, 20619, 23018, 28417, 30650, 37215, 41308, 46405, 51072, 57607, 61596, 72927, 79670, 88055, 94618, 109799, 116312, 134067, 143952, 155287
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

  • Python
    from sympy.core.numbers import igcdex
    def A345434(n): return sum(u**2+v**2 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

A345416 Table read by upward antidiagonals: Given m, n >= 1, write gcd(m,n) as d = u*m+v*n where u, v are minimal; T(m,n) = v.

Original entry on oeis.org

1, 1, 0, 1, 1, 0, 1, -1, 1, 0, 1, 1, 1, 0, 0, 1, -2, -1, 1, 1, 0, 1, 1, 2, 1, -1, 0, 0, 1, -3, 1, -1, 1, 0, 1, 0, 1, 1, -2, -1, 1, 1, 1, 0, 0, 1, -4, 3, 2, -1, 1, -1, -1, 1, 0, 1, 1, 1, 1, 3, 1, -2, 0, 0, 0, 0, 1, -5, -3, -2, -3, -1, 1, 2, 1, 1, 1, 0, 1, 1, 4, -2, 2, -1, 1, 1, -1, 1, -1, 0, 0
Offset: 1

Views

Author

N. J. A. Sloane, Jun 19 2021

Keywords

Comments

The gcd is given in A003989, and u is given in A345415. Minimal means minimize u^2+v^2. We follow Maple, PARI, etc., in setting u=0 and v=1 when m=n. If we ignore the diagonal, the v table is the transpose of the u table.

Examples

			The gcd table (A003989) begins:
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
[1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]
[1, 1, 3, 1, 1, 3, 1, 1, 3, 1, 1, 3, 1, 1, 3, 1]
[1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4]
[1, 1, 1, 1, 5, 1, 1, 1, 1, 5, 1, 1, 1, 1, 5, 1]
[1, 2, 3, 2, 1, 6, 1, 2, 3, 2, 1, 6, 1, 2, 3, 2]
[1, 1, 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, 1, 7, 1, 1]
[1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 8]
[1, 1, 3, 1, 1, 3, 1, 1, 9, 1, 1, 3, 1, 1, 3, 1]
[1, 2, 1, 2, 5, 2, 1, 2, 1, 10, 1, 2, 1, 2, 5, 2]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 11, 1, 1, 1, 1, 1]
[1, 2, 3, 4, 1, 6, 1, 4, 3, 2, 1, 12, 1, 2, 3, 4]
...
The u table (A345415) begins:
[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
[0, 0, -1, 1, -2, 1, -3, 1, -4, 1, -5, 1, -6, 1, -7, 1]
[0, 1, 0, -1, 2, 1, -2, 3, 1, -3, 4, 1, -4, 5, 1, -5]
[0, 0, 1, 0, -1, -1, 2, 1, -2, -2, 3, 1, -3, -3, 4, 1]
[0, 1, -1, 1, 0, -1, 3, -3, 2, 1, -2, 5, -5, 3, 1, -3]
[0, 0, 0, 1, 1, 0, -1, -1, -1, 2, 2, 1, -2, -2, -2, 3]
[0, 1, 1, -1, -2, 1, 0, -1, 4, 3, -3, -5, 2, 1, -2, 7]
[0, 0, -1, 0, 2, 1, 1, 0, -1, -1, -4, -1, 5, 2, 2, 1]
[0, 1, 0, 1, -1, 1, -3, 1, 0, -1, 5, -1, 3, -3, 2, -7]
[0, 0, 1, 1, 0, -1, -2, 1, 1, 0, -1, -1, 4, 3, -1, -3]
[0, 1, -1, -1, 1, -1, 2, 3, -4, 1, 0, -1, 6, -5, -4, 3]
[0, 0, 0, 0, -2, 0, 3, 1, 1, 1, 1, 0, -1, -1, -1, -1]
...
The v table (this entry) begins:
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]
[1, -1, 1, 1, -1, 0, 1, -1, 0, 1, -1, 0, 1, -1, 0, 1]
[1, 1, -1, 1, 1, 1, -1, 0, 1, 1, -1, 0, 1, 1, -1, 0]
[1, -2, 2, -1, 1, 1, -2, 2, -1, 0, 1, -2, 2, -1, 0, 1]
[1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 0, 1, 1, 1, -1]
[1, -3, -2, 2, 3, -1, 1, 1, -3, -2, 2, 3, -1, 0, 1, -3]
[1, 1, 3, 1, -3, -1, -1, 1, 1, 1, 3, 1, -3, -1, -1, 0]
[1, -4, 1, -2, 2, -1, 4, -1, 1, 1, -4, 1, -2, 2, -1, 4]
[1, 1, -3, -2, 1, 2, 3, -1, -1, 1, 1, 1, -3, -2, 1, 2]
[1, -5, 4, 3, -2, 2, -3, -4, 5, -1, 1, 1, -5, 4, 3, -2]
[1, 1, 1, 1, 5, 1, -5, -1, -1, -1, -1, 1, 1, 1, 1, 1]
...
		

Crossrefs

Programs

  • Maple
    mygcd:=proc(a,b) local d,s,t; d := igcdex(a,b,`s`,`t`); [a,b,d,s,t]; end;
    gcd_rowv:=(m,M)->[seq(mygcd(m,n)[5],n=1..M)];
    for m from 1 to 12 do lprint(gcd_rowv(m,16)); od;
  • Mathematica
    T[m_, n_] := Module[{u, v}, MinimalBy[{u, v} /. Solve[u^2 + v^2 <= 26 && u*m + v*n == GCD[m, n], {u, v}, Integers], #.#&][[1, 2]]];
    Table[T[m - n + 1, n], {m, 1, 13}, {n, 1, m}] // Flatten (* Jean-François Alcover, Mar 27 2023 *)

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

A345433 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, 7, 12, 22, 30, 49, 66, 91, 114, 160, 189, 253, 300, 355, 420, 529, 597, 733, 819, 931, 1053, 1252, 1365, 1564, 1737, 1945, 2121, 2437, 2604, 2965, 3222, 3511, 3813, 4147, 4398, 4912, 5292, 5701, 6039, 6670, 7011, 7705, 8160, 8638, 9201, 10030, 10479, 11272, 11856, 12568, 13212, 14266
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

  • Python
    from sympy.core.numbers import igcdex
    def A345433(n): return sum(abs(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

A345418 Table read by upward antidiagonals: Given m, n >= 1, write gcd(prime(m),prime(n)) as d = u*prime(m)+v*prime(n) where u, v are minimal; T(m,n) = v.

Original entry on oeis.org

1, -1, 1, -2, 1, 1, -3, 2, -1, 1, -5, -2, 1, 1, 1, -6, 4, 3, -2, -1, 1, -8, -4, -2, 1, 1, 1, 1, -9, 6, -5, -3, 2, 2, -1, 1, -11, -6, 7, 2, 1, -1, -2, 1, 1, -14, 8, 4, 5, 6, -5, -2, -1, -1, 1, -15, 10, -9, -8, -3, 1, 2, 3, 2, -1, 1, -18, -10, 6, 10, 7, 4, -3, -4, -3, -1, 1, 1
Offset: 1

Views

Author

N. J. A. Sloane, Jun 19 2021

Keywords

Comments

The gcd is 1 unless m=n when it is m; u is given in A345417. Minimal means minimize u^2+v^2. We follow Maple, PARI, etc., in setting u=0 and v=1 when m=n. If we ignore the diagonal, the v table is the transpose of the u table.

Examples

			The u table (A345417) begins:
[0, -1, -2, -3, -5, -6, -8, -9, -11, -14, -15, -18, -20, -21, -23, -26]
[1,  0,  2, -2,  4, -4,  6, -6,   8,  10, -10, -12,  14, -14,  16,  18]
[1, -1,  0,  3, -2, -5,  7,  4,  -9,   6,  -6,  15,  -8, -17,  19, -21]
[1,  1, -2,  0, -3,  2,  5, -8,  10,  -4,   9,  16,   6,  -6, -20, -15]
[1, -1,  1,  2,  0,  6, -3,  7,  -2,   8, -14, -10,  15,   4, -17, -24]
[1,  1,  2, -1, -5,  0,  4,  3,  -7,   9,  12, -17,  19,  10, -18,  -4]
[1, -1, -2, -2,  2, -3,  0,  9,  -4,  12,  11, -13, -12,  -5, -11,  25]
[1,  1, -1,  3, -4, -2, -8,  0,  -6,  -3, -13,   2,  13,  -9,   5,  14]
[1, -1,  2, -3,  1,  4,  3,  5,   0,  -5,  -4,  -8, -16,  15,  -2, -23]
[1, -1, -1,  1, -3, -4, -7,  2,   4,   0,  15, -14,  17,   3,  13,  11]
[1,  1,  1, -2,  5, -5, -6,  8,   3, -14,   0,   6,   4, -18,  -3,  12]
[1,  1, -2, -3,  3,  6,  6, -1,   5,  11,  -5,   0,  10,   7,  14, -10]
...
The v table (this entry) begins:
[  1,   1,  1,  1,   1,   1,   1,   1,  1,   1,   1,  1,   1,  1,   1,  1]
[ -1,   1, -1,  1,  -1,   1,  -1,   1, -1,  -1,   1,  1,  -1,  1,  -1, -1]
[ -2,   2,  1, -2,   1,   2,  -2,  -1,  2,  -1,   1, -2,   1,  2,  -2,  2]
[ -3,  -2,  3,  1,   2,  -1,  -2,   3, -3,   1,  -2, -3,  -1,  1,   3,  2]
[ -5,   4, -2, -3,   1,  -5,   2,  -4,  1,  -3,   5,  3,  -4, -1,   4,  5]
[ -6,  -4, -5,  2,   6,   1,  -3,  -2,  4,  -4,  -5,  6,  -6, -3,   5,  1]
[ -8,   6,  7,  5,  -3,   4,   1,  -8,  3,  -7,  -6,  6,   5,  2,   4, -8]
[ -9,  -6,  4, -8,   7,   3,   9,   1,  5,   2,   8, -1,  -6,  4,  -2, -5]
[-11,   8, -9, 10,  -2,  -7,  -4,  -6,  1,   4,   3,  5,   9, -8,   1, 10]
[-14,  10,  6, -4,   8,   9,  12,  -3, -5,   1, -14, 11, -12, -2,  -8, -6]
[-15, -10, -6,  9, -14,  12,  11, -13, -4,  15,   1, -5,  -3, 13,   2, -7]
[-18, -12, 15, 16, -10, -17, -13,   2, -8, -14,   6,  1,  -9, -6, -11,  7]
...
		

Crossrefs

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-10 of 18 results. Next