The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A308780 First element of the periodic part of the continued fraction expansion of sqrt(k), where the period is 2. 0
1, 2, 1, 3, 2, 1, 4, 2, 1, 5, 2, 1, 6, 4, 3, 2, 1, 7, 2, 1, 8, 4, 2, 1, 9, 6, 3, 2, 1, 10, 5, 4, 2, 1, 11, 2, 1, 12, 8, 6, 4, 3, 2, 1, 13, 2, 1, 14, 7, 4, 2, 1, 15, 10, 6, 5, 3, 2, 1, 16, 8, 4, 2, 1, 17, 2, 1, 18, 12, 9, 6, 4, 3, 2, 1, 19, 2, 1 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
EXAMPLE
The continued fractions for sqrt(3..8) are:
3 1;1,2
4 2 (square)
5 2;4
6 2;2,4
7 2;1,1,1,4
8 2;1,4
Those for 3, 6 and 8 have a period of 2, therefore the sequence starts with 1, 2, 1.
MAPLE
s := proc(n) if not issqr(n) then numtheory[cfrac](sqrt(n), 'periodic', 'quotients')[2]; if nops(%) = 2 then return %[1] fi fi; NULL end:
seq(s(n), n=1..399); # Peter Luschny, Jul 01 2019
MATHEMATICA
Reap[For[k = 3, k <= 399, k++, If[!IntegerQ[Sqrt[k]], cf = ContinuedFraction[Sqrt[k]]; If[Length[cf[[2]]] == 2, Sow[cf[[2, 1]]]]]]][[2, 1]] (* Jean-François Alcover, May 03 2024 *)
(* Second program (much simpler): *)
Table[2 a/b, {a, 1, 20}, {b, Rest@Divisors[2 a]}] // Flatten (* Jean-François Alcover, May 04 2024, after a remark by Kevin Ryde *)
CROSSREFS
Sequence in context: A083368 A112379 A361101 * A246700 A073932 A082404
KEYWORD
nonn,changed
AUTHOR
Georg Fischer, Jun 24 2019
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 16 05:56 EDT 2024. Contains 372549 sequences. (Running on oeis4.)