|
|
A365837
|
|
Largest proper square divisor of n, for n >= 2; a(1) = 1.
|
|
1
|
|
|
1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 1, 1, 4, 1, 9, 1, 4, 1, 1, 1, 4, 1, 1, 9, 4, 1, 1, 1, 16, 1, 1, 1, 9, 1, 1, 1, 4, 1, 1, 1, 4, 9, 1, 1, 16, 1, 25, 1, 4, 1, 9, 1, 4, 1, 1, 1, 4, 1, 1, 9, 16, 1, 1, 1, 4, 1, 1, 1, 36, 1, 1, 25, 4, 1, 1, 1, 16, 9, 1, 1, 4, 1, 1, 1, 4, 1, 9, 1, 4, 1, 1, 1, 16, 1, 49, 9, 25
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,8
|
|
LINKS
|
|
|
MAPLE
|
f:= proc(n) local F, t;
if issqr(n) then
n/min(numtheory:-factorset(n))^2
else
F:= ifactors(n)[2];
mul(t[1]^(2*floor(t[2]/2)), t=F)
fi
end proc:
f(1):= 1:
|
|
MATHEMATICA
|
Join[{1}, Table[Last[Select[Divisors[n], # < n && IntegerQ[Sqrt[#]] &]], {n, 2, 100}]]
f[p_, e_] := p^(2*Floor[e/2]); a[n_] := Module[{fct = FactorInteger[n]}, Times @@ f @@@ fct/If[AllTrue[fct[[;; , 2]], EvenQ], fct[[1, 1]]^2, 1]]; Array[a, 100] (* Amiram Eldar, Oct 19 2023 *)
|
|
PROG
|
(PARI) a(n) = if (n==1, 1, my(d=divisors(n)); vecmax(select(issquare, Vec(d, #d-1)))); \\ Michel Marcus, Oct 17 2023
(Python)
from math import prod
from sympy import factorint
if n<=1: return 1
f = factorint(n)
return prod(p**(e&-2) for p, e in f.items())//(min(f)**2 if all(e&1^1 for e in f.values()) else 1) # Chai Wah Wu, Oct 20 2023
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|