A384693
a(n) is the number of lattice points (r,s) such that 0
0, 0, 0, 0, 2, 3, 3, 3, 5, 7, 9, 9, 13, 14, 16, 21, 26, 27, 29, 29, 33, 35, 37, 37, 42, 48, 52, 56, 62, 63, 70, 70, 76, 77, 81, 83, 94, 95, 95, 98, 108, 109, 113, 113, 118, 125, 127, 127, 140, 146, 156, 160, 167, 168, 174, 180, 187, 188, 191, 191, 206, 207, 208, 216, 228, 234, 239, 239, 247, 249, 258, 258, 275, 276, 280, 292
Offset: 0
Keywords
Examples
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.
Crossrefs
Cf. A033996.
Programs
-
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 ]
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).
Comments