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.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Mar 06 2023

Keywords

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.

Examples

			a(9) = a(3^2) = a(3) = 3 (as 3 is not a square).
		

Crossrefs

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

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.