

A338307


a(n) is the smallest positive integer m such that n appears as the denominator of a convergent to sqrt(m).


4



1, 2, 3, 3, 2, 8, 15, 15, 6, 24, 3, 2, 12, 7, 3, 61, 5, 80, 11, 6, 30, 59, 46, 28, 42, 127, 14, 12, 2, 44, 7, 32, 13, 233, 8, 20, 10, 13, 19, 77, 3, 22, 33, 23, 132, 113, 33, 7, 23, 75, 27, 42, 75, 71, 15, 3, 73, 61, 60, 11, 43, 41, 15, 159, 17, 54, 32, 72, 59, 2, 13, 5, 38, 116, 69, 90, 133, 300, 95, 207, 105, 302, 74, 110, 173, 97, 93, 74, 6, 47, 138, 132, 107, 96, 86, 114, 47, 457, 24, 156
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

For n > 2, a(n) <= ceiling(n/2)^2  1, since for m > 1, sqrt(m^2  1) has convergents (2m^2  m  1)/(2m  1) and (2m^2  1)/(2m). Apparently, this bound is achieved only for n in {3, 4, 6, 7, 8, 10, 18}.
Is there an efficient algorithm for computing a(n)?


LINKS

Table of n, a(n) for n=1..100.


MATHEMATICA

a[n_] := Module[{a, b, r, q, v}, If[n == 1, Return[1]]; For[m = 1, True, m++, If[IntegerQ[Sqrt[m]], Continue]; r = Sqrt[m] // Floor; a = 0; b = 1; q = {1, 0}; While[q[[2]] < n && b != 0, v = Quotient[r+a, b]; a = b va; b = (m  a^2)/b; q = {{0, 1}, {1, v}}.q]; If[q[[2]] == n, Return[m]]]];
Array[a, 100] (* JeanFrançois Alcover, Oct 23 2020, after PARI code *)


PROG

(PARI) { A338307(n) = my(a, b, r, q, v); if(n==1, return(1)); for(m=1, oo, if(issquare(m), next); r=sqrtint(m); a=0; b=1; q=[1, 0]~; while(q[2]<n, v=(r+a)\b; a=b*va; b=(ma^2)/b; q=[0, 1; 1, v]*q; ); if(q[2]==n, return(m)); ); }


CROSSREFS

Cf. A338308.
Sequence in context: A304311 A175393 A184829 * A153290 A153516 A153311
Adjacent sequences: A338304 A338305 A338306 * A338308 A338309 A338310


KEYWORD

nonn


AUTHOR

Max Alekseyev, Oct 21 2020


STATUS

approved



