Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
The minimum value of j + k where j and k are positive integers with j^2 + k^2 = A001481(n).
3

%I #21 Sep 09 2022 11:07:26

%S 0,1,2,2,3,4,3,4,5,4,5,6,6,5,6,7,8,8,6,7,8,9,9,7,8,10,9,10,11,8,9,10,

%T 12,11,12,12,9,10,11,13,12,13,14,10,11,12,14,13,15,14,15,11,12,13,16,

%U 14,16,15,12,13,16,14,17,15,17,16,18,18,13,14,15,16

%N The minimum value of j + k where j and k are positive integers with j^2 + k^2 = A001481(n).

%H Peter Kagey, <a href="/A328803/b328803.txt">Table of n, a(n) for n = 1..10000</a>

%e For n = 14, A001481(14) = 25 = 0^2 + 5^2 = 3^2 + 4^2, so a(14) = min{0+5, 3+4} = 5.

%p N:= 1000: # for terms where A001481(n)<=N

%p for s from 0 to isqrt(N) do

%p for i from 0 to s/2 do

%p t:= i^2 + (s-i)^2;

%p if t > N then break fi;

%p if not assigned(R[t]) then R[t]:= s fi;

%p od od:

%p A1481:= sort(map(op, [indices(R)])):

%p seq(R[i],i=A1481); # _Robert Israel_, Oct 28 2019

%o (Python)

%o from itertools import count, islice

%o from sympy.solvers.diophantine.diophantine import diop_DN

%o from sympy import factorint

%o def A328803_gen(): # generator of terms

%o return map(lambda n: min((a+b for a, b in diop_DN(-1,n))), filter(lambda n:(lambda m:all(d&3!=3 or m[d]&1==0 for d in m))(factorint(n)), count(0)))

%o A328803_list = list(islice(A328803_gen(),30)) # _Chai Wah Wu_, Sep 09 2022

%Y Cf. A000161, A001481.

%K nonn,look

%O 1,3

%A _Peter Kagey_, Oct 27 2019