login
Integers whose square root has a continued fraction [b(0);[b(1),...,b(p)]] with a period p > 2 such that b(1)=b(2)=...=b(p-1).
1

%I #31 Apr 24 2020 16:27:47

%S 7,13,32,41,55,58,74,75,130,135,136,180,185,215,269,312,335,346,370,

%T 377,425,427,458,557,560,646,697,711,818,819,880,925,986,987,1064,

%U 1067,1129,1130,1272,1313,1325,1326,1400,1462,1490,1495,1613,1714,1736,1885

%N Integers whose square root has a continued fraction [b(0);[b(1),...,b(p)]] with a period p > 2 such that b(1)=b(2)=...=b(p-1).

%C Any periodic continued fraction represents a rational number, in particular [b(0);[c,c,...,c,b(p)]]. An integer requires b(p)=2*b(0). The exclusion of p < 3 makes sense because there should be at least two constant c-terms. Note that, with m=a0, the terms associated with the continued fractions [m;[2m]] (p=1) and [m;[c,2m]] (p=2) are those in A320773.

%C General aspect: If [m;[c,c,...,c,2m]] is an integer, it belongs to a quadratic subsequence, see link "Special periodic continued fractions".

%C The four sequences below, see formula, cover 336 of the first 500 terms.

%H Gerhard Kirchner, <a href="/A331960/a331960_1.pdf">Special periodic continued fractions</a>

%F Formulas for some quadratic subsequences:

%F p,c formula first term a(1) thru a(500)

%F (k=1) frequency

%F 4,1 (3k-1)^2 + 4k-1 a(1) = 7 125

%F 5,1 (5k-2)^2 + 6k-2 a(2) = 13 75

%F 3,2 (5k+1)^2 + 4k+1 a(4) = 41 74

%F 4,2 (6k+1)^2 + 5k+1 a(5) = 55 62

%e 7 = [2; [1, 1, 1, 4]]

%e 13 = [3; [1, 1, 1, 1, 6]]

%e 32 = [5; [1, 1, 1, 10]]

%e 41 = [6; [2, 2, 12]]

%e 55 = [7; [2, 2, 2, 14]]

%t a:={};For[k=0, k<2000, k++, b:=Last[ContinuedFraction[Sqrt[k]]]; p:=Length[b]; If[p>2, For[i=2, i<p&& Extract[b, 1]==Extract[b, i], i++, If[i==p-1, AppendTo[a,k]]]]]; a (* _Stefano Spezia_, Feb 04 2020 *)

%o (Maxima) block([an: 2, n: 0, nmax: 100],

%o /*transfers the first nmax terms to a file in the current directory*/

%o fl: openw(concat("terms-A331960-",nmax, ".txt")),

%o while n<nmax do

%o (an: an+1, w: sqrt(an), m: floor(w),

%o if w > m and mod(2*m,an-m^2)>0 then

%o (a: m, i: 0, x: w, ok: true,

%o while a<2*m and ok do

%o (i: i+1, x: 1/(x-floor(x)),

%o a: floor(x),

%o if i=1 then c: a

%o elseif a # c and a<2*m then ok: false),

%o if ok then(n: n+1, printf( fl, "~d, ", an)))),

%o close(fl));

%Y Cf. A320773.

%K nonn

%O 1,1

%A _Gerhard Kirchner_, Feb 02 2020