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.

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

This page as a plain text file.
%I A031424 #17 May 20 2021 14:03:26
%S A031424 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 A031424 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 A031424 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 A031424 Least term in period of continued fraction for sqrt(n), as n runs through the nonsquares (A000037).
%H A031424 Charles R Greathouse IV, <a href="/A031424/b031424.txt">Table of n, a(n) for n = 1..10000</a>
%t A031424 Min[ContinuedFraction[Sqrt[#]][[2]]]&/@Select[Range[ 200],!IntegerQ[ Sqrt[ #]]&] (* _Harvey P. Dale_, May 20 2021 *)
%o A031424 (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 A031424 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 A031424 Cf. A276689, A000037.
%K A031424 nonn
%O A031424 1,1
%A A031424 _David W. Wilson_
%E A031424 Name corrected by _Charles R Greathouse IV_, Aug 10 2017