login
The OEIS is supported by the many generous donors to the OEIS 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). 7

%I #17 May 20 2021 14:03:26

%S 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,

%T 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,

%U 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

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

%H Charles R Greathouse IV, <a href="/A031424/b031424.txt">Table of n, a(n) for n = 1..10000</a>

%t Min[ContinuedFraction[Sqrt[#]][[2]]]&/@Select[Range[ 200],!IntegerQ[ Sqrt[ #]]&] (* _Harvey P. Dale_, May 20 2021 *)

%o (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)))

%o 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

%Y Cf. A276689, A000037.

%K nonn

%O 1,1

%A _David W. Wilson_

%E Name corrected by _Charles R Greathouse IV_, Aug 10 2017

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 20:08 EDT 2024. Contains 371963 sequences. (Running on oeis4.)