proposed
approved
proposed
approved
editing
proposed
a(n) = smallest prime p such that continued fraction of (1 + sqrt(p))/2 has period length n.
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: [From _# _R. J. Mathar_, Nov 08 2008]
$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*) [From _ _Artur Jasinski_, Feb 03 2010])
approved
editing
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*) [From _Artur Jasinski (grafix(AT)csl.pl), _, Feb 03 2010]
_Artur Jasinski (grafix(AT)csl.pl), _, Oct 30 2008
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: [From _R. J. Mathar (mathar(AT)strw.leidenuniv.nl), _, Nov 08 2008]
a(25) replaced by 929 and extended by _R. J. Mathar (mathar(AT)strw.leidenuniv.nl), _, Nov 08 2008
editing
approved
Artur Jasinski, <a href="/A146363/b146363.txt">Table of n, a(n) for n=1,...,1000</a>
nonn,new
nonn
Artur Jasinski, <a href="b146363.txt">Table of n, a(n) for n=1,...,1000</a>
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*) [From Artur Jasinski (grafix(AT)csl.pl), Feb 03 2010]
nonn,new
nonn
a(n) = smallest prime p such that continued fraction of (1+Sqrt[p])/2 has period length n.
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
1,1
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: [From R. J. Mathar (mathar(AT)strw.leidenuniv.nl), Nov 08 2008]
$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*)
nonn
Artur Jasinski (grafix(AT)csl.pl), Oct 30 2008
a(25) replaced by 929 and extended by R. J. Mathar (mathar(AT)strw.leidenuniv.nl), Nov 08 2008
approved