OFFSET
1,2
COMMENTS
A386838(k) is the minimal area of the graph formed under the requirement that the straight line drawn from (0,0) to (x,y) (where x^2 + y^2 = k = A001481(n)) passes through an enclosed space on the square lattice and its edges are either vertical or horizontal. If A001481(n) = x^2 + y^2 for multiple x and y, then x and y are chosen such that A386838(A001481(n)) is minimal. a(n) is the number of graphs with area n, and equivalently the number of numbers of the form x^2 + y^2 = A001481(n) such that n = x + y - gcd(x,y) for such minimal x and y.
The offset is 1 since 0 occurs infinitely many times in A386838 (e.g., A386838(k) = 0 when A001481(k) is square).
The range in which n can occur in A386838 is bounded above by 2*n^2.
Does every integer n > 0 appear in this sequence?
EXAMPLE
a(5) = 2 since 5 appears twice in A386838.
PROG
(PARI) a(n) = my(f, A = []); (f(n) = my(g, S, T = []); (g(n) = my(P = []); for(x = 0, sqrtint(n), my(y2 = n - x^2); if(issquare(y2), my(y = sqrtint(y2)); if(x <= y, P = concat(P, [[x, y]])))); return(P)); S = g(n); if(#S == 0, return(0), for(k = 1, #S, T = concat(T, S[k][1] + S[k][2] - gcd(S[k][1], S[k][2]))); return(vecmin(T)))); for(k = 1, 2*n^2, if(f(k) == n, A = concat(A, f(k)))); return(#A)
CROSSREFS
KEYWORD
nonn
AUTHOR
Miles Englezou, Aug 06 2025
STATUS
approved
