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.

A255980 Number of iterations of A067565 required to reach a perfect square.

Original entry on oeis.org

0, 1, 1, 0, 1, 2, 1, 2, 0, 2, 1, 3, 1, 2, 3, 0, 1, 3, 1, 4, 3, 2, 1, 4, 0, 2, 4, 4, 1, 5, 1, 5, 3, 2, 5, 0, 1, 2, 3, 5, 1, 6, 1, 4, 6, 2, 1, 6, 0, 6, 3, 4, 1, 7, 5, 7, 3, 2, 1, 7, 1, 2, 7, 0, 5, 6, 1, 4, 3, 8, 1, 8, 1, 2, 8, 4, 8, 6, 1, 7, 0, 2, 1, 9, 5, 2, 3
Offset: 1

Views

Author

Peter Kagey, Mar 12 2015

Keywords

Comments

Iterating A067565 will always result in a perfect square, because all fixed points are squares, and A067565(n) <= n all n.
a(n) = 0 if and only if n is a perfect square.
a(n) = 1 if and only if n is prime.

Examples

			Let g(n) = A067565(n)
a(12) = 3 because g(g(g(12))) = g(g(6)) = g(3) = 0, which is a perfect square.
		

Crossrefs

Cf. A067565.

Programs

  • Ruby
    def a(n)
      c = 0
      n = a067565(n) while n.is_nonsquare? && c += 1
      c
    end