login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A361253
If n = m^2 for some m > 1 then a(n) = a(m), otherwise a(n) = n.
1
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,3
COMMENTS
All terms belong to A000037 U { 0, 1 }.
All terms of A000037 appear infinitely many times.
This sequence can be seen as the limit of the k-th iterate of A097448 as k tends to infinity.
LINKS
FORMULA
a(a(n)) = a(n).
a(n) <= A097448(n).
a(n) = 2 iff n belongs to A001146.
a(n) = 3 iff n belongs to A011764.
a(n) = 5 iff n belongs to A176594.
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