OFFSET
0,5
COMMENTS
This sequence gives the number of invisible lattice points along circular arcs surrounded in a n X n square. Visibility is defined for the family (x-t)^2 + y^2 = t^2, for t being a positive rational, this sequence is important in the sense that it proves that density of invisible points goes to 0 and hence density of visible points comes out to be 1.
FORMULA
Define I(r,s) = 1 if there exists an integer d, 1 <= d < r, such that ((r^2 + s^2)*d - r*d^2) / r is a perfect square, and I(r,s) = 0 otherwise.
Let a(0) = 0. For n >= 1, a(n) = a(n-1) + Sum_{s=1..n} I(n,s) + Sum_{r=1..n-1} I(r,n).
EXAMPLE
For n=4, a(4) = 2 because (2,4) and (4,2) are the only points for which there exists a d (1 for both cases) for which ((2^2+4^2)d-2d^2)/2 is a perfect square for some integer d, 0<d<2 and ((4^2+2^)d-4d^2)/4 is a perfect square for some integer d, 0<d<4.
For n=5, a(5) = 3 because (2,4) and (4,2) are the points already there satisfying the criterion; also, (5,5) is another point because ((5^2+5^2)*1-5*1^2)/5 = 9, which is a perfect square. Hence, a(5)=3.
PROG
(Haskell)
isSquare n = (floor . sqrt . fromIntegral $ n) ^ 2 == n
valid a b = not $ null [() | d <- [1..a-1]
, let (q, r) =((a^2 + b^2) * d - a * d^2) `divMod` a
, r == 0
, isSquare q]
count n = length
[ ()
| a <- [1..n]
, b <- [1..n]
, valid a b
]
CROSSREFS
KEYWORD
nonn
AUTHOR
Piyush Kumar Jha, Jul 23 2025
STATUS
approved
