login
A146363
a(n) = smallest prime p such that continued fraction of (1 + sqrt(p))/2 has period length n.
6
5, 2, 17, 7, 41, 19, 89, 31, 73, 43, 541, 103, 421, 179, 193, 191, 521, 139, 241, 151, 337, 491, 433, 271, 929, 211, 409, 487, 673, 379, 937, 463, 601, 331, 769, 1439, 2297, 619, 1033, 1399, 1777, 571, 1753, 823, 1993, 739, 1249, 631, 4337, 1051, 1321, 751, 1201
OFFSET
1,1
LINKS
MAPLE
A := proc(n) option remember ; local c; try c := numtheory[cfrac](1/2+sqrt(n)/2, 'periodic, quotients') ; RETURN(nops(c[2]) ); catch: RETURN(-1) end try ; end: A146363 := proc(n) local p, i ; for i from 1 do p := ithprime(i) ; if A(p) = n then RETURN(p) ; fi; od; end: for n from 1 do printf("%d, ", A146363(n)) ; od: # R. J. Mathar, Nov 08 2008
MATHEMATICA
$MaxExtraPrecision = 300; s = 10; aa = {}; Do[k = ContinuedFraction[(1 + Sqrt[n])/2, 1000]; If[Length[k] < 190, AppendTo[aa, 0], m = 1; While[k[[s ]] != k[[s + m]] || k[[s + m]] != k[[s + 2 m]] || k[[s + 2 m]] != k[[s + 3 m]] || k[[s + 3 m]] != k[[s + 4 m]], m++ ]; s = s + 1; While[k[[s ]] != k[[s + m]] || k[[s + m]] != k[[s + 2 m]] || k[[s + 2 m]] != k[[s + 3 m]] || k[[s + 3 m]] != k[[s + 4 m]], m++ ]; AppendTo[aa, m]], {n, 1, 1200}]; Print[aa]; bb = {}; Do[k = 1; yes = 0&&PeimeQ[k]; Do[If[aa[[k]] == n && yes == 0, AppendTo[bb, k]; yes = 1], {k, 1, Length[aa]}], {n, 1, 22}]; bb (* Artur Jasinski *)
aa = {}; Do[n = 1; While[m != Length[ContinuedFraction[(1 + Sqrt[Prime[n]])/2][[2]]], n++ ]; AppendTo[aa, Prime[n]], {m, 1, 100}]; aa (* Artur Jasinski, Feb 03 2010)
KEYWORD
nonn
AUTHOR
Artur Jasinski, Oct 30 2008
EXTENSIONS
a(25) replaced by 929 and extended by R. J. Mathar, Nov 08 2008
STATUS
approved