OFFSET
1,1
COMMENTS
Manhattan and Euclidean are distance measures from the origin for v as coordinates of a point in n-dimensional space.
Integer Euclidean(v) requires that v is a Pythagorean n-tuple.
These distances are a walk from the origin by a positive integer number of unit steps in each of the n dimensions, and a return to the origin by a straight line which is also an integer number of unit steps.
When n is a square, a(n) = n + sqrt(n) from v all 1's.
EXAMPLE
For n=2, v is the legs of a Pythagorean triangle and the smallest Manhattan + Euclidean is a(2) = 12 from v = {3,4}.
a(3) = 8 because 1 + 2 + 2 + sqrt(1^2 + 2^2 + 2^2) = 1 + 2 + 2 + 3 = 8.
a(4) = 6 because 1 + 1 + 1 + 1 + sqrt(1^2 + 1^2 + 1^2 + 1^2) = 1 + 1 + 1 + 1 + 2 = 6.
a(29) = 42: 3^2 + (4 * 2^2) + (24 * 1^2) = 7^2, and 6^2 + (28 * 1^2) = 8^2 (first term with multiple different examples).
PROG
(PARI) a(n)={my(r=oo); for(c=0, oo, if(n+sqrtint(n-1)+1+c>=r, return(r)); forpart(p=c, my(s=sum(i=1, #p, (p[i]+1)^2)+(n-#p)); if(issquare(s), r=min(r, n+c+sqrtint(s))), , n))}
CROSSREFS
KEYWORD
nonn
AUTHOR
Charles L. Hohn, Jun 17 2025
STATUS
approved
