login
A338319
a(n) is the smallest positive integer m such that n appears as the denominator of a semiconvergent to sqrt(m).
2
1, 2, 2, 3, 2, 8, 2, 7, 5, 11, 3, 2, 5, 7, 3, 11, 2, 13, 10, 6, 5, 11, 8, 23, 10, 3, 14, 12, 2, 31, 7, 32, 13, 23, 8, 20, 10, 5, 15, 40, 2, 22, 10, 23, 39, 27, 15, 7, 6, 51, 26, 41, 19, 71, 5, 3, 17, 14, 24, 11, 26, 41, 15, 8, 17, 54, 21, 72, 6, 2, 13, 5, 17, 96
OFFSET
1,2
COMMENTS
a(n) <= A338307(n).
PROG
(PARI) { A338319(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*v-a; b=(m-a^2)/b; q=[0, 1; 1, v]*q; ); if(Mod(q[2], q[1])==n, return(m)); ); }
CROSSREFS
Sequence in context: A015999 A225244 A345281 * A369748 A280583 A177047
KEYWORD
nonn
AUTHOR
Max Alekseyev, Oct 22 2020
STATUS
approved