login
A393160
a(n) is the largest possible integer Euclidean distance between two lattice points with coordinates in the interval 0..n.
2
0, 1, 2, 3, 5, 5, 6, 7, 10, 10, 10, 11, 15, 15, 15, 17, 20, 20, 20, 20, 25, 29, 29, 29, 30, 30, 30, 30, 35, 35, 35, 35, 40, 40, 40, 40, 45, 45, 45, 45, 50, 50, 58, 58, 58, 58, 58, 58, 60, 60, 60, 60, 65, 65, 65, 73, 73, 73, 73, 73, 75, 75, 75, 87, 87, 87, 87
OFFSET
0,3
COMMENTS
In other words, a(n)^2 is the largest sum of two square numbers <= n^2.
LINKS
Rémy Sigrist, PARI program
FORMULA
a(n) = A393159(n, n).
EXAMPLE
a(4) = 5 corresponds to the distance between, among others, the lattice points (0, 0) and (3, 4).
PROG
(PARI) \\ See Links section.
(Python)
from math import isqrt
def A393160(n):
c, s = 0, {x**2 for x in range(isqrt(n**2<<1)+1)}
for x in range(n+1):
z = x**2+(m:=isqrt(max(0, c-x**2)))**2
for y in range(m, x+1):
if z>c and z in s:
c = z
z += (y<<1)+1
return isqrt(c) # Chai Wah Wu, Feb 08 2026
CROSSREFS
Cf. A393159.
Sequence in context: A373188 A067535 A076752 * A079114 A058189 A361676
KEYWORD
nonn
AUTHOR
Rémy Sigrist, Feb 03 2026
STATUS
approved