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.

A249160 Smallest number of iterations k such that A068527^(k)(n)=A068527^(k+1)(n).

Original entry on oeis.org

1, 0, 2, 1, 2, 3, 1, 2, 1, 4, 3, 2, 3, 1, 2, 1, 3, 2, 4, 3, 2, 3, 1, 2, 1, 5, 2, 3, 2, 4, 3, 2, 3, 1, 2, 1, 3, 4, 5, 2, 3, 2, 4, 3, 2, 3, 1, 2, 1, 2, 4, 3, 4, 5, 2, 3, 2, 4, 3, 2, 3, 1, 2, 1, 2, 3, 2, 4, 3, 4, 5, 2, 3, 2, 4, 3, 2, 3, 1, 2, 1, 3, 4, 2, 3, 2, 4, 3, 4, 5, 2, 3, 2, 4, 3, 2, 3, 1, 2, 1
Offset: 1

Views

Author

Valtteri Raiko, Oct 22 2014

Keywords

Comments

Given a number n, denote its distance from next perfect square >= n as R(n), sequence A068527. The function R(n) has two fixed points, 0 and 2, and for all n>=3, R(n)=0, there exists a k>=0 such that R^(k)(n)=R^(k+1)(n)=0 or 2. This sequence gives the number of iterations needed to reach the fixed point starting at n.
This sequence is unbounded, but grows very slowly, reaching records of 1, 2, 3, 4, 6 etc at n=1, 3, 6, 10, 26, 170, 7226, etc.

Examples

			R(10) = 6, R(6) = 3, R(3) = 1, R(1) = 0, R(0) = 0. Thus a(10) = 4.
		

Crossrefs

Cf. A068527.

Programs

  • Maple
    A249160 := proc(n)
        local k,prev,this;
        prev := n ;
        for k from 1 do
            this := A068527(prev) ;
            if this = prev then
                return k-1;
            end if;
            prev := this ;
        end do:
    end proc:
    seq(A249160(n),n=1..80) ; # R. J. Mathar, Nov 17 2014
  • Mathematica
    r[n_]:=Ceiling[Sqrt[n]]^2-n;Table[Length[FixedPointList[r,n]]-2,{n,1,100}]
  • PARI
    r(n)=if(issquare(n),0,(sqrtint(n)+1)^2-n);
    le(n)=b=0;while(n!=0&&n!=2,b=b+1;n=r(n));return(b);
    range(n) = c=List(); for(a = 1, n, listput(c,a)); return(c);
    apply(le, range(100))