OFFSET
1,4
COMMENTS
a(n) = (number of pairs (i,j) in [1..n] X [1..n] with integral geometric mean sqrt(i*j)) - (number of pairs (i,j) in [1..n] X [1..n] with integral harmonic mean 2*i*j/(i+j)).
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
MAPLE
a:= proc(n) option remember; `if`(n=0, 0, 2*add(
`if`(irem(2*i*n, i+n)=0, -1, 0)+
`if`(issqr(i*n), 1, 0), i=1..n-1)+a(n-1))
end:
seq(a(n), n=1..80); # Alois P. Heinz, Aug 28 2023
MATHEMATICA
Block[{c, q}, c[n_] := c[n] = Flatten[Table[w^2 - x*y, {w, n}, {x, n}, {y, n}]]; q[n_] := q[n] = Flatten[Table[(2*i*j)/(i + j), {i, n}, {j, n}]]; Table[Count[c[n], 0] - Count[q[n], _?IntegerQ], {n, 80}] ] (* Michael De Vlieger, Aug 28 2023 *)
PROG
(Python)
from sympy.ntheory.primetest import is_square
def A362932(n): return sum((1 if T else -1) for x in range(1, n+1) for y in range(1, x) if (T:=is_square(x*y))^(not (x*y<<1)%(x+y)))<<1 # Chai Wah Wu, Aug 28 2023
CROSSREFS
KEYWORD
sign,look
AUTHOR
N. J. A. Sloane, Aug 28 2023
STATUS
approved