[go: up one dir, main page]

login
Revision History for A146363 (Bold, blue-underlined text is an addition; faded, red-underlined text is a deletion.)

Showing all changes.
a(n) = smallest prime p such that continued fraction of (1 + sqrt(p))/2 has period length n.
(history; published version)
#10 by N. J. A. Sloane at Sun Aug 06 22:27:58 EDT 2017
STATUS

proposed

approved

#9 by Jon E. Schoenfield at Sun Aug 06 21:27:36 EDT 2017
STATUS

editing

proposed

#8 by Jon E. Schoenfield at Sun Aug 06 21:27:28 EDT 2017
NAME

a(n) = smallest prime p such that continued fraction of (1 + sqrt(p))/2 has period length n.

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: [From _# _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*) [From _ _Artur Jasinski_, Feb 03 2010])

STATUS

approved

editing

#7 by Russ Cox at Sat Mar 31 10:22:15 EDT 2012
MATHEMATICA

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]

AUTHOR

_Artur Jasinski (grafix(AT)csl.pl), _, Oct 30 2008

Discussion
Sat Mar 31
10:22
OEIS Server: https://oeis.org/edit/global/339
#6 by Russ Cox at Fri Mar 30 17:39:45 EDT 2012
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: [From _R. J. Mathar (mathar(AT)strw.leidenuniv.nl), _, Nov 08 2008]

EXTENSIONS

a(25) replaced by 929 and extended by _R. J. Mathar (mathar(AT)strw.leidenuniv.nl), _, Nov 08 2008

Discussion
Fri Mar 30
17:39
OEIS Server: https://oeis.org/edit/global/190
#5 by Charles R Greathouse IV at Fri Jul 29 21:22:08 EDT 2011
STATUS

editing

approved

#4 by Charles R Greathouse IV at Fri Jul 29 21:22:04 EDT 2011
NAME

a(n) = smallest prime p such that continued fraction of (1+Sqrt[sqrt(p]))/2 has period length n.

LINKS

Artur Jasinski, <a href="/A146363/b146363.txt">Table of n, a(n) for n=1,...,1000</a>

STATUS

approved

editing

#3 by N. J. A. Sloane at Thu Nov 11 07:34:06 EST 2010
LINKS

Artur Jasinski, <a href="/A146363/b146363.txt">Table of n, a(n) for n=1,...,1000</a>

KEYWORD

nonn,new

nonn

#2 by N. J. A. Sloane at Tue Jun 01 03:00:00 EDT 2010
LINKS

Artur Jasinski, <a href="b146363.txt">Table of n, a(n) for n=1,...,1000</a>

MATHEMATICA

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]

KEYWORD

nonn,new

nonn

#1 by N. J. A. Sloane at Fri Jan 09 03:00:00 EST 2009
NAME

a(n) = smallest prime p such that continued fraction of (1+Sqrt[p])/2 has period length n.

DATA

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

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: [From R. J. Mathar (mathar(AT)strw.leidenuniv.nl), 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*)

KEYWORD

nonn

AUTHOR

Artur Jasinski (grafix(AT)csl.pl), Oct 30 2008

EXTENSIONS

a(25) replaced by 929 and extended by R. J. Mathar (mathar(AT)strw.leidenuniv.nl), Nov 08 2008

STATUS

approved