cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-4 of 4 results.

A020347 Numbers k such that the continued fraction for sqrt(k) has period 6.

Original entry on oeis.org

19, 21, 22, 45, 52, 54, 57, 59, 70, 77, 88, 107, 111, 112, 114, 117, 131, 164, 165, 175, 178, 183, 187, 208, 216, 221, 232, 267, 270, 273, 275, 278, 280, 285, 294, 296, 303, 308, 350, 357, 371, 372, 374, 381, 387, 407, 418, 437, 456, 470, 498, 499, 507, 510, 514, 518
Offset: 1

Views

Author

Keywords

Comments

Includes A157265, corresponding to continued fractions [6*k+4,1,1,2,1,1,12*k+8,1,1,2,1,1,12*k+8,...]. - Robert Israel, Nov 21 2019

Examples

			The continued fraction for sqrt(19) is 4 + 1/(2 + 1/(1 + 1/(3 + 1/(1 + 1/(2 + 1/(8 + 1/(2 + 1/(1 + 1/(3 + 1/(1 + 1/(2 + 1/(8 + ..., which has period 6, so 19 is in the sequence.
The continued fraction for sqrt(20) is 4 + 1/(2 + 1/(8 + 1/(2 + 1/(8 + 1/(2 + 1/(8 + ..., which has a period of 2, so 20 is not in the sequence.
		

Crossrefs

Cf. A157265.

Programs

  • Maple
    filter:= proc(n)
      not issqr(n) and nops(numtheory:-cfrac(sqrt(n),periodic,quotients)[2])=6
    end proc:
    select(filter, [$1..1000]); # Robert Israel, Nov 21 2019
  • Mathematica
    Select[Range[500], Length[Last[ContinuedFraction[Sqrt[#]]]] == 6 &] (* Alonso del Arte, Mar 04 2018 *)

A157266 a(n) = 1728*n - 408.

Original entry on oeis.org

1320, 3048, 4776, 6504, 8232, 9960, 11688, 13416, 15144, 16872, 18600, 20328, 22056, 23784, 25512, 27240, 28968, 30696, 32424, 34152, 35880, 37608, 39336, 41064, 42792, 44520, 46248, 47976, 49704, 51432, 53160, 54888, 56616, 58344
Offset: 1

Views

Author

Vincenzo Librandi, Feb 26 2009

Keywords

Comments

The identity (10368*n^2-4896*n+577)^2-(36*n^2-17*n+2)*(1728*n-408)^2=1 can be written as A157267(n)^2-A157265(n)*a(n)^2=1 (see also the second comment in A157267). - Vincenzo Librandi, Jan 27 2012

Crossrefs

Programs

  • Magma
    I:=[1320, 3048]; [n le 2 select I[n] else 2*Self(n-1)-Self(n-2): n in [1..50]]; // Vincenzo Librandi, Jan 27 2012
    
  • Mathematica
    LinearRecurrence[{2,-1},{1320,3048},40] (* Vincenzo Librandi, Jan 27 2012 *)
    Table[1728n-408,{n,40}] (* Harvey P. Dale, Apr 18 2020 *)
  • PARI
    for(n=1, 40, print1(1728*n - 408", ")); \\ Vincenzo Librandi, Jan 27 2012

Formula

a(n) = 2*a(n-1) - a(n-2). - Vincenzo Librandi, Jan 27 2012
G.f.: x*(1320+408*x)/(x-1)^2. - Vincenzo Librandi, Jan 27 2012
E.g.f.: 24*((72*x - 17)*exp(x) + 17). - G. C. Greubel, Feb 04 2018

A157267 a(n) = 10368*n^2 - 4896*n + 577.

Original entry on oeis.org

6049, 32257, 79201, 146881, 235297, 344449, 474337, 624961, 796321, 988417, 1201249, 1434817, 1689121, 1964161, 2259937, 2576449, 2913697, 3271681, 3650401, 4049857, 4470049, 4910977, 5372641, 5855041, 6358177, 6882049, 7426657, 7992001, 8578081, 9184897, 9812449
Offset: 1

Views

Author

Vincenzo Librandi, Feb 26 2009

Keywords

Comments

The identity (10368*n^2 - 4896*n + 577)^2 - (36*n^2 - 17*n + 2)*(1728*n - 408)^2 = 1 can be written as a(n)^2 - A157265(n)*A157266(n)^2 = 1. - Vincenzo Librandi, Jan 27 2012
This is the case s = 4*n - 1 of the identity (2*r^2 - 1)^2 - ((r^2 - 1)/144)*(24*r)^2 = 1, where r = 18*s + 9*i^(s*(s+1)) - (-1)^s - 9 and i = sqrt(-1). - Bruno Berselli, Jan 29 2012

Crossrefs

Programs

  • Magma
    I:=[6049, 32257, 79201]; [n le 3 select I[n] else 3*Self(n-1)-3*Self(n-2)+1*Self(n-3): n in [1..40]]; // Vincenzo Librandi, Jan 27 2012
    
  • Mathematica
    LinearRecurrence[{3,-3,1},{6049,32257,79201},40] (* Vincenzo Librandi, Jan 27 2012 *)
  • PARI
    for(n=1, 40, print1(10368*n^2 - 4896*n + 577", ")); \\ Vincenzo Librandi, Jan 27 2012

Formula

From Vincenzo Librandi, Jan 27 2012: (Start)
G.f.: x*(6049 + 14110*x + 577*x^2)/(1-x)^3.
a(n) = 3*a(n-1) - 3*a(n-2) + a(n-3). (End)
E.g.f.: exp(x)*(10368*x^2 + 5472*x + 577) - 577. - Elmo R. Oliveira, Nov 09 2024

A334116 a(n) is the least number k greater than n such that the square roots of both k and n have continuous fractions with the same period p and, if p > 1, the same periodic terms except for the last term.

Original entry on oeis.org

1, 5, 8, 4, 10, 12, 32, 15, 9, 17, 40, 20, 74, 33, 24, 16, 26, 39, 1880, 30, 112, 660, 96, 35, 25, 37, 104, 299, 338, 42, 77600, 75, 60, 78, 48, 36, 50, 84, 68, 87, 130, 56, 288968, 468, 350, 3242817, 192, 63, 49, 65, 200, 2726, 1042, 1628, 180, 72, 308, 425, 5880, 95
Offset: 1

Views

Author

Gerhard Kirchner, Apr 14 2020

Keywords

Comments

Note that a(n)=n if n is a square. The square root of a squarefree integer n has a continued fraction of the form [e(0);[e(1),...,e(p)]] with e(p)=2e(0) and e(i)=e(p-i) for 0 < i < p, see reference. The symmetric part [e(1),...,e(p-1)] of the continued fraction [m;[e(1),...,e(p-1), 2m]] will be called the pattern of n. 2 has the empty pattern (sqrt(2)=[1,[2]]), 3 has the pattern [1] (sqrt(3)=[1,[1,2]]) and so on. In this sense, the description of the sequence can be simplified as "Least number greater than n with the same pattern".
It can be can proved (see link) that integers with the same pattern are terms of a quadratic sequence.
An ambiguity has to be fixed: sqrt(2)=[1,[2]] = [1,[2,2]] = [1,[2,2,2]] and so on. We define that the shortest pattern is correct, here it is empty. Comment on the third subsequence (2),6,12,... below: The second term 6 has the pattern [2], but the first term 2 in brackets has the "wrong" pattern, after fixing the ambiguity.

Examples

			1) p=1: f(1)=2, f(2)=a(2)=5, f(3)=a(5)=10, f(4)=a(10)=17,..
sqrt(2)=[1,[2]], sqrt(5)=[2,[4]], sqrt(10)=[3,[6]], sqrt(17)=[4,[8]],..
2) p=2: f(1)=3, f(2)=a(3)=8, f(3)=a(8)=15, f(4)=a(15)=24,..
sqrt(3)=[1,[1,2]], sqrt(8)=[2,[1,4]], sqrt(15)=[3,[1,6]], sqrt(24)=[4,[1,8]],..
3) p=3: f(1)=41, f(2)=a(41)=130, f(3)=a(130)=269,..
sqrt(41)=[6,[2,2,12]], sqrt(130)=[11,[2,2,121]], sqrt(269)=[16,[2,2,256]],..
4) p=4: f(1)=33, f(2)=a(33)=60, f(3)=a(60)=95,..
sqrt(33)=[5,[1,2,1,10]], sqrt(60)=[7,[1,2,1,49]], sqrt(95)=[9,[1,2,1,81]],..
Several subsequences f(k) with f(k+1)=a(f(k)).
k>1 if first term in brackets, k>0 otherwise.
First terms  Period  Formula           Example
1) 2,5,10,17   1  A002522(k)=k^2+1           1
2) 3,8,15,24   2  A005563(k)=(k+1)^2-1       2
3)(2),6,12     2  A002378(k)=k*(k+1)
4) 7,32,75     4  A013656(k)=k*(9*k-2)
5) 11,40,87    2  A147296(k)=k*(9*k+2)
6) 13,74,185   5  A154357(k)=25*k^2-14*k+2
7) (3),14,33   4  A033991(k)=k*(4*k-1)       4
8) (5),18,39   2  A007742(k)=k*(4*k+1)
9) 21,112,275  6  A157265(k)=36*k^2-17*k+2
10)23,96,219   4  A154376(k)=25*k^2-2*k
11)27,104,231  2  A154377(k)=25*k^2+2*k
12)28,299,858  4  A156711(k)=144*k^2-161*k+45
13)29,338,985  5  A156640(k)=169*k^2+140*k+29
14)(8),34,78   4  A154516(k)=9*k^2-k
15)(10),38,84  2  A154517(k)=9*k^2+k
16)(2),41,130  3  A154355(k)=25*k^2-36*k+13  3
17)47,192,435  4  A157362(k)=49*k^2-2*k
		

References

  • Kenneth H. Rosen, Elementary number theory and its applications, Addison-Wesley, 3rd ed. 1993, page 428.

Crossrefs

Programs

  • Maxima
    block([nmax: 100],
    /*saves the first nmax terms in the current directory*/
    algebraic: true, local(coeff), showtime: true,
    fl: openw(sconcat("terms",nmax, ".txt")),
    coeff(w,m):=
      block(a: m, p: 0, s: w, vv:[],
       while a<2*m do
        (p: p+1, s: ratsimp(1/(s-floor(s))), a: floor(s),
         if a<2*m then vv: append(vv, [a])),
       j: floor((p-1)/2),
       if mod(p,2)=0 then v: [1,0,vv[j+1]] else v: [0,1,1],
       for i from j thru 1 step(-1) do
        (h: vv[i], u: [v[1]+h*v[3], v[3], 2*h*v[1]+v[2]+h^2*v[3]], v: u),
       return(v)),
       for n from 1 thru nmax do
        (w: sqrt(n), m: floor(w),
         if w=m then  b: n else
          (v: coeff(w,m),  x: v[1], y: v[2], z: v[3], q: mod(z,2),
           if q=0 then (z: z/2, y: y/2) else x: 2*x,
           fr: (x*m+y)/z, m: m+z, fr: fr+x, b: m^2+fr),
          printf( fl, "~d, ", b)),
          close(fl));
    
  • Python
    from sympy import floor, S, sqrt
    def coeff(w,m):
        a, p, s, vv = m, 0, w, []
        while a < 2*m:
            p += 1
            s = S.One/(s-floor(s))
            a = floor(s)
            if a < 2*m:
                vv.append(a)
        j = (p-1)//2
        v = [0,1,1] if p % 2 else [1, 0, vv[j]]
        for i in range(j-1,-1,-1):
            h = vv[i]
            v = [v[0]+h*v[2], v[2], 2*h*v[0]+v[1]+h**2*v[2]]
        return v
    def A334116(n):
        w = sqrt(n)
        m = floor(w)
        if w == m:
            return n
        else:
            x, y, z = coeff(w,m)
            if z % 2:
                x *= 2
            else:
                z //= 2
                y //= 2
            return (m+z)**2+x+(x*m+y)//z # Chai Wah Wu, Sep 30 2021, after Maxima code
Showing 1-4 of 4 results.