OFFSET
0,3
COMMENTS
LINKS
Michael De Vlieger, Table of n, a(n) for n = 0..10000
FORMULA
EXAMPLE
a(9) = a(3^2) = a(3) = 3 (as 3 is not a square).
MATHEMATICA
nn = 120; Array[Set[a[#], #] &, 2, 0]; Do[If[IntegerQ[#], Set[k, a[#]], Set[k, n]] &[Sqrt[n]]; Set[a[n], k], {n, nn}]; Array[a, nn] (* Michael De Vlieger, Mar 06 2023 *)
PROG
(PARI) a(n) = my (m); { while (n > 1 && issquare(n, &m), n = m); return (n) }
(Python)
from sympy import integer_nthroot
def A361253(n):
if n <= 1:
return n
a, b = integer_nthroot(c:=n, 2)
while b:
a, b = integer_nthroot(c:=a, 2)
return c # Chai Wah Wu, Mar 17 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Rémy Sigrist, Mar 06 2023
STATUS
approved