OFFSET
1,2
COMMENTS
The greatest prime factor of n that has an odd exponent in the prime factorization of n, or 1 is no such prime exists. - Amiram Eldar, Oct 28 2024
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..20000
Hugo Pfoertner, Illustration of first 10^5 terms, zoom into central part to see nice patterns.
EXAMPLE
For n = 15000 = 5^4 * 3 * 2^3, 3 is the greatest unpaired prime, so a(15000) = 3.
MAPLE
a:= n-> max(1, seq(i[1]^irem(i[2], 2), i=ifactors(n)[2])):
seq(a(n), n=1..100); # Alois P. Heinz, Mar 07 2018
MATHEMATICA
Array[FactorInteger[Sqrt[#] /. (c_: 1)*a_^(b_: 0) :> (c*a^b)^2][[-1, 1]] &, 74] (* Michael De Vlieger, Mar 10 2018, after Bill Gosper at A007913 *)
PROG
(PARI) gpf(n) = if (n==1, 1, vecmax(factor(n)[, 1]));
a(n) = gpf(core(n)); \\ Michel Marcus, Mar 08 2018
(PARI) a(n) = {my(f = factor(n)); forstep(i = #f~, 1, -1, if(f[i, 2] % 2, return(f[i, 1]))); 1; } \\ Amiram Eldar, Oct 28 2024
(Magma) [#f eq 0 select 1 else f[#f][1] where f is Factorization(Squarefree(n)): n in [1..90]]; // Vincenzo Librandi, Mar 08 2018
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Peter Kagey, Mar 07 2018
STATUS
approved