cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A361253 If n = m^2 for some m > 1 then a(n) = a(m), otherwise a(n) = n.

This page as a plain text file.
%I A361253 #24 Mar 17 2023 13:17:57
%S A361253 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,
%T A361253 27,28,29,30,31,32,33,34,35,6,37,38,39,40,41,42,43,44,45,46,47,48,7,
%U A361253 50,51,52,53,54,55,56,57,58,59,60,61,62,63,8,65,66,67,68
%N A361253 If n = m^2 for some m > 1 then a(n) = a(m), otherwise a(n) = n.
%C A361253 All terms belong to A000037 U { 0, 1 }.
%C A361253 All terms of A000037 appear infinitely many times.
%C A361253 This sequence can be seen as the limit of the k-th iterate of A097448 as k tends to infinity.
%H A361253 Michael De Vlieger, <a href="/A361253/b361253.txt">Table of n, a(n) for n = 0..10000</a>
%F A361253 a(a(n)) = a(n).
%F A361253 a(n) <= A097448(n).
%F A361253 a(n) = 2 iff n belongs to A001146.
%F A361253 a(n) = 3 iff n belongs to A011764.
%F A361253 a(n) = 5 iff n belongs to A176594.
%e A361253 a(9) = a(3^2) = a(3) = 3 (as 3 is not a square).
%t A361253 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 *)
%o A361253 (PARI) a(n) = my (m); { while (n > 1 && issquare(n, &m), n = m); return (n) }
%o A361253 (Python)
%o A361253 from sympy import integer_nthroot
%o A361253 def A361253(n):
%o A361253     if n <= 1:
%o A361253         return n
%o A361253     a, b = integer_nthroot(c:=n,2)
%o A361253     while b:
%o A361253         a, b = integer_nthroot(c:=a,2)
%o A361253     return c # _Chai Wah Wu_, Mar 17 2023
%Y A361253 Cf. A000037, A001146, A011764, A176594, A097448.
%K A361253 nonn,easy
%O A361253 0,3
%A A361253 _Rémy Sigrist_, Mar 06 2023