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.

A338785 a(n) is the least number k such that continued fraction for sqrt(prime(k)) has period n.

This page as a plain text file.
%I A338785 #11 Nov 11 2020 19:37:57
%S A338785 1,2,13,4,6,8,21,11,30,14,18,27,44,41,29,43,37,34,68,36,42,94,147,58,
%T A338785 88,47,186,93,142,75,110,90,112,67,178,228,82,114,100,222,187,105,191,
%U A338785 143,204,131,180,115,172,177,197,133,263,272,353,175,231,242,322,157
%N A338785 a(n) is the least number k such that continued fraction for sqrt(prime(k)) has period n.
%H A338785 Robert Israel, <a href="/A338785/b338785.txt">Table of n, a(n) for n = 1..1000</a>
%F A338785 a(n) = A000720(A059800(n)).
%e A338785 sqrt(prime(1))  = sqrt(2)  = 1 + 1/(2 + 1/(2 + ...)), period 1.
%e A338785 sqrt(prime(2))  = sqrt(3)  = 1 + 1/(1 + 1/(2 + 1/(1 + 1/(2 + ...)))), period 2.
%e A338785 sqrt(prime(13)) = sqrt(41) = 6 + 1/(2 + 1/(2 + 1/(12 + 1/(2 + 1/(2 + 1/(12 + ...)))))), period 3.
%p A338785 N:= 100: # for a(1)..a(N)
%p A338785 A:= Vector(N): count:= 0: p:= 1:
%p A338785 for n from 1 while count < N do
%p A338785   p:= nextprime(p);
%p A338785   v:= nops(numtheory:-cfrac(sqrt(p),periodic,quotients)[2]);
%p A338785   if v <= N and A[v] = 0 then count:= count+1; A[v]:= n; fi
%p A338785 od:
%p A338785 convert(A,list); # _Robert Israel_, Nov 11 2020
%t A338785 Table[SelectFirst[Range[500], Length[Last[ContinuedFraction[Sqrt[Prime[#]]]]] == n &], {n, 60}]
%Y A338785 Cf. A000720, A013646, A054269, A059800.
%K A338785 nonn
%O A338785 1,2
%A A338785 _Ilya Gutkovskiy_, Nov 08 2020