login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A031424 Least term in period of continued fraction for sqrt(n), as n runs through the nonsquares (A000037). 2
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 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

LINKS

Charles R Greathouse IV, Table of n, a(n) for n = 1..10000

PROG

(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

CROSSREFS

Cf. A276689, A000037.

Sequence in context: A007739 A330086 A290935 * A013942 A187816 A088423

Adjacent sequences:  A031421 A031422 A031423 * A031425 A031426 A031427

KEYWORD

nonn

AUTHOR

David W. Wilson

EXTENSIONS

Name corrected by Charles R Greathouse IV, Aug 10 2017

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 9 07:55 EDT 2021. Contains 343692 sequences. (Running on oeis4.)