A361253 If n = m^2 for some m > 1 then a(n) = a(m), otherwise a(n) = n.
0, 1, 2, 3, 2, 5, 6, 7, 8, 3, 10, 11, 12, 13, 14, 15, 2, 17, 18, 19, 20, 21, 22, 23, 24, 5, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 6, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 7, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 8, 65, 66, 67, 68
Offset: 0
Examples
a(9) = a(3^2) = a(3) = 3 (as 3 is not a square).
Links
- Michael De Vlieger, Table of n, a(n) for n = 0..10000
Programs
-
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 *)
-
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
Comments