A062769
Smallest number m such that the continued fraction expansion of sqrt(m) has period 2n + 1.
Original entry on oeis.org
2, 41, 13, 58, 106, 61, 193, 109, 157, 337, 181, 586, 457, 949, 821, 601, 613, 1061, 421, 541, 1117, 1153, 1249, 1069, 1021, 1201, 1669, 2381, 1453, 2137, 2053, 1801, 2293, 1381, 1549, 3733, 3541, 3217, 5857, 1621, 3169, 4657, 2689, 3049, 2389, 4057, 4549
Offset: 0
For n = 2, 2n+1 = 5. a(2) = 13 and we indeed have sqrt(13) = [3; 1, 1, 1, 1, 6] with period 5, the first one in the sequence sqrt(29) = [5; 2, 1, 1, 2, 10], sqrt(53) = [7; 3, 1, 1, 3, 14], sqrt(74) = [8; 1, 1, 1, 1, 16], sqrt(85) = [9; 4, 1, 1, 4, 18], sqrt(89) = [9; 2, 3, 3, 2, 18], ...
-
nn = 50; t = Table[0, {nn}]; n = 1; found = 0; While[found < nn, n++; If[! IntegerQ[Sqrt[n]], c = ContinuedFraction[Sqrt[n]]; len = Length[c[[2]]]; If[OddQ[len] && (len + 1)/2 <= nn && t[[(len + 1)/2]] == 0, t[[(len + 1)/2]] = n; found++]]]; t (* T. D. Noe, Apr 04 2014 *)
A284601
Numbers k such that the decimal representation of 1/k does not terminate and has odd period.
Original entry on oeis.org
3, 6, 9, 12, 15, 18, 24, 27, 30, 31, 36, 37, 41, 43, 45, 48, 53, 54, 60, 62, 67, 71, 72, 74, 75, 79, 81, 82, 83, 86, 90, 93, 96, 106, 107, 108, 111, 120, 123, 124, 129, 134, 135, 142, 144, 148, 150, 151, 155, 158, 159, 162, 163, 164, 166, 172, 173, 180, 185, 186, 191, 192, 199, 201, 205, 212, 213, 214, 215
Offset: 1
27 is in the sequence because 1/27 = 0.0370(370)... period is 3, 3 is odd.
2 and 5 are not in the sequence because 1/2 = 0.5 and 1/5 = 0.2 are terminating expansions. See also comments in A051626 and A284602.
-
filter:= proc(n) local m;
m:= n/2^padic:-ordp(n,2);
m:= m/5^padic:-ordp(m,5);
m > 1 and numtheory:-order(10,m)::odd
end proc:
select(filter, [$1..1000]); # Robert Israel, Apr 03 2017
-
Select[Range[215], Mod[Length[RealDigits[1/#][[1, -1]]], 2] == 1 & ]
A031422
Numbers k such that the continued fraction for sqrt(k) has odd period and if the last term of the periodic part is deleted then there are a pair of central terms both equal to 9.
Original entry on oeis.org
601, 1073, 1930, 2017, 2621, 2825, 3037, 3533, 3769, 4013, 4714, 5701, 6218, 6373, 6689, 7013, 7757, 8461, 8825, 9197, 9277, 12629, 13394, 13621, 14081, 14549, 15613, 15754, 18265, 18797, 20005, 20282, 20441, 21410, 22277, 22993, 23762, 24065, 24370, 25114
Offset: 1
-
n = 1; t = {}; While[Length[t] < 50, n++; If[! IntegerQ[Sqrt[n]], c = ContinuedFraction[Sqrt[n]]; len = Length[c[[2]]]; If[OddQ[len] && c[[2, (len + 1)/2]] == 9, AppendTo[t, n]]]]; t (* T. D. Noe, Apr 04 2014 *)
A206587
Numbers k such that the periodic part of the continued fraction of sqrt(k) has even length.
Original entry on oeis.org
1, 3, 4, 6, 7, 8, 9, 11, 12, 14, 15, 16, 18, 19, 20, 21, 22, 23, 24, 25, 27, 28, 30, 31, 32, 33, 34, 35, 36, 38, 39, 40, 42, 43, 44, 45, 46, 47, 48, 49, 51, 52, 54, 55, 56, 57, 59, 60, 62, 63, 64, 66, 67, 68, 69, 70, 71, 72, 75, 76, 77, 78, 79, 80, 81, 83, 84
Offset: 1
Cf.
A003814 (period has odd length).
-
Select[Range[100], IntegerQ[Sqrt[#]] || EvenQ[Length[ContinuedFraction[Sqrt[#]][[2]]]] &]
-
cyc(cf) = {
if(#cf==1, return([])); \\ There is no cycle
my(s=[]);
for(k=2, #cf,
s=concat(s, cf[k]);
if(cf[k]==2*cf[1], return(s)) \\ Cycle found
);
0 \\ Cycle not found
}
select(n->#cyc(contfrac(sqrt(n)))%2==0, vector(400, n, n)) \\ Colin Barker, Oct 19 2014
A307303
Triangle T(n, k) read as upwards antidiagonals of array A, where A(n, k) is the number of families (also called classes) of proper solutions of the Pell equation x^2 - D(n)*y^2 = -k, for k >= 1.
Original entry on oeis.org
1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1, 0, 2, 0, 1, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 2, 0
Offset: 1
The array A(n, k) begins:
n, D(n) \k 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ...
-------------------------------------------------------------------
1, 2: 1 1 0 0 0 0 2 0 0 0 0 0 0 2 0
2, 3: 0 1 1 0 0 0 0 0 0 0 2 0 0 0 0
3, 5: 1 0 0 2 1 0 0 0 0 0 2 0 0 0 0
4, 6: 0 1 0 0 2 1 0 0 0 0 0 0 0 0 2
5, 7: 0 0 2 0 0 2 1 0 0 0 0 0 0 1 0
6, 8: 0 0 0 1 0 0 2 1 0 0 0 0 0 0 0
7, 10: 1 0 0 0 0 2 0 0 2 1 0 0 0 0 2
8, 11: 0 1 0 0 0 0 2 0 0 2 1 0 0 0 0
9, 12: 0 0 1 0 0 0 0 2 0 0 2 1 0 0 0
10, 13: 1 0 2 2 0 0 0 0 2 0 0 4 1 0 0
11, 14: 0 0 0 0 2 0 1 0 0 2 0 0 2 1 0
12, 15: 0 0 0 0 0 1 0 0 0 0 2 0 0 2 1
13, 17: 1 0 0 0 0 0 0 2 0 0 0 0 2 0 0
14, 18: 0 1 0 0 0 0 0 0 2 0 0 0 0 2 0
15, 19: 0 1 2 0 0 0 0 0 0 2 0 0 0 0 4
16, 20: 0 0 0 1 0 0 0 0 0 0 2 0 0 0 0
17, 21: 0 0 1 0 2 0 0 0 0 0 0 2 0 0 0
18, 22: 0 1 0 0 0 0 2 0 0 0 0 0 2 0 0
19, 23: 0 0 0 0 0 0 0 0 0 0 2 0 0 2 0
20, 24: 0 0 0 0 0 0 0 1 0 0 0 0 0 0 2
-------------------------------------------------------------------
The triangle T(n, k) begins:
n\k 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ..
1: 1
2: 0 1
3: 1 1 0
4: 0 0 1 0
5: 0 1 0 0 0
6: 0 0 0 2 0 0
7: 1 0 2 0 1 0 2
8: 0 0 0 0 2 0 0 0
9: 0 1 0 1 0 1 0 0 0
10: 1 0 0 0 0 2 0 0 0 0
11: 0 0 1 0 0 0 1 0 0 0 0
12: 0 0 2 0 0 2 2 0 0 0 2 0
13: 1 0 0 2 0 0 0 1 0 0 2 0 0
14: 0 0 0 0 0 0 2 0 0 0 0 0 0 2
15: 0 1 0 0 2 0 0 0 2 0 0 0 0 0 0
16: 0 1 0 0 0 0 0 2 0 1 0 0 0 0 0 0
17: 0 0 2 0 0 1 1 0 0 2 0 0 0 0 0 0 2
18: 0 0 0 0 0 0 0 0 2 0 1 0 0 1 2 0 0 0
19: 0 1 1 1 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0
20: 0 0 0 0 0 0 0 2 0 2 0 1 0 0 0 0 0 0 0 0
...
For this triangle more than the shown columns of the array have been used.
----------------------------------------------------------------------------
A(5, 6) = 2 = T(10, 6) because D(5) = 7, and the Pell form F(5) with disc(F(5)) = 4*7 = 28 representing k = -6 has 2 families (classes) of proper solutions generated from the two positive fundamental positive solutions (x10, y10) = (13, 5) and (x20, y20) = (1, 1). They are obtained from the trivial solutions of the parallel forms [-6, 2, 1] and [-6, 10, -3], respectively.
- D. A. Buell, Binary Quadratic Forms, Springer, 1989.
- A. Scholz and B. Schoeneberg, Einführung in die Zahlentheorie, 5. Aufl., de Gruyter, Berlin, New York, 1973.
A031414
Numbers k such that the continued fraction for sqrt(k) has odd period and if the last term of the periodic part is deleted then there are a pair of central terms both equal to 1.
Original entry on oeis.org
13, 29, 53, 58, 74, 85, 97, 106, 125, 137, 157, 173, 185, 229, 233, 241, 293, 298, 314, 338, 346, 353, 365, 389, 397, 425, 433, 445, 457, 461, 533, 538, 541, 554, 557, 593, 629, 634, 641, 661, 673, 698, 733, 746, 754, 769, 794, 818, 821, 829, 845, 857, 877
Offset: 1
The continued fraction of sqrt[29] is {5; 2, 1, 1, 2, 10}. The center number in the periodic part is 1.
-
n = 1; t = {}; While[Length[t] < 60, n++; If[! IntegerQ[Sqrt[n]], c = ContinuedFraction[Sqrt[n]]; len = Length[c[[2]]]; If[OddQ[len] && c[[2, (len + 1)/2]] == 1, AppendTo[t, n]]]]; t (* T. D. Noe, Apr 03 2014 *)
A031415
Numbers k such that the continued fraction for sqrt(k) has odd period and if the last term of the periodic part is deleted then there are a pair of central terms both equal to 2.
Original entry on oeis.org
41, 61, 113, 130, 181, 202, 265, 269, 313, 317, 394, 421, 458, 586, 613, 617, 685, 697, 761, 773, 853, 925, 929, 937, 986, 1013, 1066, 1109, 1117, 1201, 1213, 1301, 1325, 1354, 1409, 1417, 1429, 1466, 1586, 1625, 1637, 1649, 1714, 1741, 1745, 1753, 1861
Offset: 1
The simple continued fraction expansion of sqrt(41) = [6; 2, 2, 12, 2, 2, 12, 2, 2, 12, ...] with odd period 3 and two terms equal to 2. Another example is sqrt(202) = [14; 4, 1, 2, 2, 1, 4, 28, 4, 1, 2, 2, 1, 4, 28, 4, 1, 2, 2, 1, 4, 28, ...] with odd period 7 and two terms equal to 2. - _Michael Somos_, Apr 03 2014
-
n = 1; t = {}; While[Length[t] < 50, n++; If[! IntegerQ[Sqrt[n]], c = ContinuedFraction[Sqrt[n]]; len = Length[c[[2]]]; If[OddQ[len] && c[[2, (len + 1)/2]] == 2, AppendTo[t, n]]]]; t (* T. D. Noe, Apr 03 2014 *)
-
from sympy.ntheory.continued_fraction import continued_fraction_periodic
A031415_list = []
for n in range(1,10**3):
cf = continued_fraction_periodic(0,1,n)
if len(cf) > 1 and len(cf[1]) > 1 and len(cf[1]) % 2 and cf[1][len(cf[1])//2] == 2:
A031415_list.append(n) # Chai Wah Wu, Sep 16 2021
A031416
Numbers k such that the continued fraction for sqrt(k) has odd period and if the last term of the periodic part is deleted then there are a pair of central terms both equal to 3.
Original entry on oeis.org
89, 149, 193, 218, 250, 277, 337, 493, 521, 569, 653, 709, 914, 1009, 1018, 1037, 1385, 1465, 1553, 1597, 1618, 1754, 1781, 1898, 1921, 1973, 1994, 2069, 2129, 2146, 2293, 2378, 2389, 2441, 2474, 2561, 2725, 2741, 2777, 2897, 2957, 2986, 3170, 3229, 3265
Offset: 1
-
n = 1; t = {}; While[Length[t] < 60, n++; If[! IntegerQ[Sqrt[n]], c = ContinuedFraction[Sqrt[n]]; len = Length[c[[2]]]; If[OddQ[len] && c[[2, (len + 1)/2]] == 3, AppendTo[t, n]]]]; t (* T. D. Noe, Apr 03 2014 *)
cfo3Q[n_]:=Module[{s=Sqrt[n],cf,len},cf=If[IntegerQ[s],{0,0}, ContinuedFraction[ s ][[2]]];len=Length[cf];OddQ[len]&&cf[[ (len+1)/2]] == cf[[(len-1)/2]]==3]; Select[Range[3300],cfo3Q] (* Harvey P. Dale, Sep 25 2019 *)
A031417
Numbers k such that the continued fraction for sqrt(k) has odd period and if the last term of the periodic part is deleted then there are a pair of central terms both equal to 4.
Original entry on oeis.org
274, 370, 481, 797, 953, 1069, 1249, 1313, 1378, 1381, 1514, 1657, 1658, 1733, 1889, 2125, 2297, 2377, 2554, 2557, 2833, 2834, 2929, 2941, 3226, 3329, 3338, 3433, 3541, 3761, 3874, 3989, 4093, 4106, 4441, 4442, 4561, 4682, 4685, 4933, 4937, 5197, 5450
Offset: 1
The simple continued fraction for sqrt(274) = [16; 1, 1, 4, 4, 1, 1, 32, ...] with odd period 7 and central term 4. Another example is sqrt(481) = [21; 1, 13, 1, 1, 1, 4, 4, 1, 1, 1, 13, 1, 42, ...] with odd period 13 and central term 4. - _Michael Somos_, Apr 03 2014
-
n = 1; t = {}; While[Length[t] < 50, n++; If[! IntegerQ[Sqrt[n]], c = ContinuedFraction[Sqrt[n]]; len = Length[c[[2]]]; If[OddQ[len] && c[[2, (len + 1)/2]] == 4, AppendTo[t, n]]]]; t (* T. D. Noe, Apr 03 2014 *)
cf4Q[n_]:=Module[{s=Sqrt[n],cf,len},cf=If[IntegerQ[s],{1,1},ContinuedFraction[ s][[2]]];len=Length[cf];OddQ[len]&&cf[[(len+1)/2]] == cf[[(len-1)/2]]==4]; Select[Range[5500],cf4Q] (* Harvey P. Dale, Jul 28 2021 *)
A031418
Numbers k such that the continued fraction for sqrt(k) has odd period and if the last term of the periodic part is deleted then there are a pair of central terms both equal to 5.
Original entry on oeis.org
73, 373, 449, 565, 610, 757, 1021, 1145, 1193, 1594, 1669, 1906, 2053, 2074, 2138, 2314, 2477, 2593, 2861, 3065, 3145, 4129, 4346, 4373, 4469, 4498, 4721, 5018, 5114, 5386, 5741, 6025, 6317, 6617, 6737, 6925, 7241, 7489, 7522, 7897, 7978, 8017, 8186, 8314
Offset: 1
The simple continued fraction expansion of sqrt(73) = [8, 1, 1, 5, 5, 1, 1, 16, ...] of odd period 7 with a pair of central terms both equal to 5. Another example is sqrt(373) = [19, 3, 5, 5, 3, 38, ...] of odd period 5 with a pair of central terms both equal to 5. - _Michael Somos_, Apr 03 2014
-
opct5Q[n_]:=Module[{s=Sqrt[n],cf,len},If[IntegerQ[s],cf={1,1}, cf= ContinuedFraction[s][[2]]];len=Length[cf];OddQ[len] && cf[[Floor[len/2]]] == cf[[Ceiling[len/2]]]==5]; Select[Range[10000],opct5Q] (* Harvey P. Dale, Feb 22 2013 *)
Comments