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.

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.

This page as a plain text file.
%I A345423 #20 Mar 28 2023 14:50:34
%S A345423 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,
%T A345423 -31,-19,-31,-17,-53,-65,-57,-71,-92,-71,-79,-91,-95,-85,-138,-88,
%U A345423 -100,-115,-109,-125,-195,-215,-207,-191,-210,-213,-227,-199,-193,-233,-222,-238
%N 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.
%C A345423 Minimal means minimize u^2+v^2. We follow Maple, PARI, etc., in setting u=0 and v=1 when x=y.
%p A345423 mygcd:=proc(a,b) local d,s,t; d := igcdex(a,b,`s`,`t`); [a,b,d,s,t]; end;
%p A345423 ansu:=[]; ansv:=[]; ansb:=[];
%p A345423 for N from 1 to 80 do
%p A345423 tu:=0; tv:=0; tb:=0;
%p A345423 for x from 1 to N do
%p A345423 for y from 1 to N do
%p A345423 if igcd(x,y)=1 then
%p A345423    tu:=tu + mygcd(x,y)[4];
%p A345423    tv:=tv + mygcd(x,y)[5];
%p A345423    tb:=tb + mygcd(x,y)[4] + mygcd(x,y)[5];
%p A345423 fi;
%p A345423 od: od:
%p A345423 ansu:=[op(ansu),tu];
%p A345423 ansv:=[op(ansv),tv];
%p A345423 ansb:=[op(ansb),tb];
%p A345423 od:
%p A345423 ansu; # the present sequence
%p A345423 ansv; # A345424
%p A345423 ansb; # A345425
%p A345423 # for A345426, A345427, A345428, omit the "igcd(x,y)=1" test
%t A345423 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], #.# &]];
%t A345423 a[n_] := a[n] = Sum[If[GCD[x, y] == 1, T[x, y][[1, 1]], 0], {x, 1, n}, {y, 1, n}];
%t A345423 Table[Print[n, " ", a[n]]; a[n], {n, 1, 60}] (* _Jean-François Alcover_, Mar 28 2023 *)
%o A345423 (Python)
%o A345423 from sympy.core.numbers import igcdex
%o A345423 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
%Y A345423 Cf. A345415-A345428.
%K A345423 sign
%O A345423 1,3
%A A345423 _N. J. A. Sloane_, Jun 22 2021