OFFSET
1,8
COMMENTS
a(n) = 0 if and only if n is squarefree: a(A005117(n)) = 0 for all n, and a(A013929(n)) > 0 for all n.
If a(n) = a(m) != 0, then n = m.
Proof: Without loss of generality, assume a(n) = a(m) < n < m. Then n*a(n)*m*a(m) is square and a(n)*a(m) is square, which implies that n*m is square. Notice that n > a(m), so a(m) is not the greatest integer k such that k*m is square. This is a contradiction.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
EXAMPLE
For n = 63, a(63) = 28 because 28*63 = (7*4)*(7*9) = (7*2*3)^2 = 42^2, and there is no integer 28 < k < 63 such that 63*k is square.
MAPLE
f:= proc(n) local F, r;
F:= ifactors(n)[2];
r:= mul(t[1], t = select(t -> t[2]::odd, F));
r*(ceil(sqrt(n/r))-1)^2;
end proc: # Robert Israel, Sep 10 2017
MATHEMATICA
a[n_] := If[SquareFreeQ[n], 0, For[k = n-1, k > 0, k--, If[IntegerQ[ Sqrt[ k*n] ], Return[k]]]]; Array[a, 80] (* Jean-François Alcover, Sep 11 2017 *)
PROG
(PARI) forstep (k=n-1, 1, -1, if (issquare(k*n), return (k))); return (0); \\ Michel Marcus, Sep 10 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Kagey, Sep 09 2017
STATUS
approved