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.

Showing 1-1 of 1 results.

A031424 Least term in period of continued fraction for sqrt(n), as n runs through the nonsquares (A000037).

Original entry on oeis.org

2, 1, 4, 2, 1, 1, 6, 3, 2, 1, 1, 1, 8, 4, 1, 2, 1, 1, 1, 1, 10, 5, 2, 1, 2, 1, 1, 1, 1, 1, 12, 6, 4, 3, 2, 2, 1, 1, 1, 1, 1, 1, 14, 7, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 16, 8, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 18, 9, 6, 1, 1, 3, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 20, 10, 1, 5, 4, 1
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    Min[ContinuedFraction[Sqrt[#]][[2]]]&/@Select[Range[ 200],!IntegerQ[ Sqrt[ #]]&] (* Harvey P. Dale, May 20 2021 *)
  • PARI
    do(n)=my(a0=sqrtint(n),a,b=a0,c=n-a0^2,bold,cold,least=2*a0); while(1, a=(a0+b)\c; if(a<2, return(1)); least=min(least,a); bold=b; b=a*c-b; cold=c; c=(n-b^2)\c; if(b==bold || c==cold, return(least)))
    first(n)=my(v=vector(n),k,i); while(1, k++; for(m=k^2+1,k^2+2*k, if(i++>n, return(v)); v[i]=do(m))) \\ Charles R Greathouse IV, Aug 10 2017

Extensions

Name corrected by Charles R Greathouse IV, Aug 10 2017
Showing 1-1 of 1 results.