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-10 of 10 results.

A006266 A continued cotangent.

Original entry on oeis.org

2, 14, 2786, 21624372014, 10111847525912679844192131854786, 1033930953043290626825587838528711318150300040875029341893199068078185510802565166824630504014
Offset: 0

Views

Author

Keywords

Comments

The next (6th) term is 280 digits long. - M. F. Hasler, Oct 06 2014

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Magma
    [Evaluate(DicksonFirst(3^n, -1), 2): n in [0..7]]; // G. C. Greubel, Mar 25 2022
    
  • Maple
    a := proc(n) option remember; if n = 1 then 14 else a(n-1)^3 + 3*a(n-1) end if; end: seq(a(n), n = 1..5); # Peter Bala Nov 15 2022
  • Mathematica
    Table[Round[(1+Sqrt[2])^(3^n)],{n,0,10}] (* Artur Jasinski, Sep 24 2008 *)
    LucasL[3^Range[0, 7], 2] (* G. C. Greubel, Mar 25 2022 *)
  • PARI
    a(n,s=2)=for(i=2,n,s*=(s^2+3));s \\ M. F. Hasler, Oct 06 2014
    
  • Sage
    [lucas_number2(3^n,2,-1) for n in (0..7)] # G. C. Greubel, Mar 25 2022

Formula

From Artur Jasinski, Sep 24 2008: (Start)
a(n+1) = a(n)^3 + 3*a(n) with a(0) = 2.
a(n) = round((1+sqrt(2))^(3^n)). [Corrected by M. F. Hasler, Oct 06 2014] (End)
From Peter Bala, Nov 15 2022: (Start)
a(n) = A002203(3^n).
a(n) = L(3^n,2), where L(n,x) denotes the n-th Lucas polynomial of A114525.
a(n) == 2 (mod 3).
a(n+1) == a(n) (mod 3^(n+1)) for n >= 1 (a particular case of the Gauss congruences for the companion Pell numbers).
The smallest positive residue of a(n) mod(3^n) = A271222(n).
In the ring of 3-adic integers the limit_{n -> oo} a(n) exists and is equal to A271224. Cf. A006267. (End)

Extensions

Edited by M. F. Hasler, Oct 06 2014
Offset corrected by G. C. Greubel, Mar 25 2022

A271223 Digits of one of the two 3-adic integers sqrt(-2).

Original entry on oeis.org

1, 1, 2, 0, 0, 2, 0, 1, 0, 0, 0, 2, 1, 2, 0, 1, 0, 1, 1, 0, 2, 2, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 2, 1, 0, 1, 2, 0, 2, 2, 0, 2, 0, 1, 2, 0, 1, 2, 2, 2, 1, 0, 2, 0, 1, 2, 0, 2, 0, 0, 1, 1, 2, 1, 0, 1, 2, 1, 1, 2, 0
Offset: 0

Views

Author

Wolfdieter Lang, Apr 05 2016

Keywords

Comments

This is the scaled first difference sequence of A268924. See the formula.
The digits of the other 3-adic integer sqrt(-2), are given in A271224. See also A268924 for the two 3-adic numbers sqrt(-2), called there u and -u.
a(n) is the unique solution of the linear congruence 2*A268924(n)*a(n) + A271225(n) == 0 (mod 3), n>=1. Therefore only the values 0, 1, and 2 appear. See the Nagell reference given in A268922, eq. (6) on p. 86, adapted to this case. a(0) = 1 follows from the formula given below.
For details see the Wolfdieter Lang link under A268992.
The first k digits in the base 3 representation of Lucas(3^n) give the first k terms of the sequence. For example, the base 3 representation of Lucas(3^5) = 84722519070079276 begins 1 + 1*3 + 2*(3^2) + 0*(3^3) + 0*(3^4) + ... so the sequence begins [1, 1, 2, 0, 0, ...]. - Peter Bala, Nov 15 2022

Examples

			a(4) = 0 because 2*22*3 + 6 = 138 == 0 (mod 3).
a(4) = - 6*(2*22) (mod 3) = -0*(2*1) (mod 3) = 0.
A268924(5) =  22 = 1*3^0 + 1*3^1 + 2*3^2 + 0*3^3 + 0*3^4.
		

References

  • Trygve Nagell, Introduction to Number Theory, Chelsea Publishing Company, New York, 1964, pp. 86 and 77-78.

Crossrefs

Programs

  • Maple
    # uses properties of the numbers Lucas(3^n) = A006267(n)
    a := proc(n) option remember; if n = 1 then 1 else irem(a(n-1)^3 + 3*a(n-1), 3^n) end if; end proc:
    convert(a(70), base, 3); # Peter Bala, Nov 15 2022
  • PARI
    a(n) = truncate(sqrt(-2+O(3^(n+1))))\3^n; \\ Michel Marcus, Apr 09 2016

Formula

a(n) = (b(n+1) - b(n))/3^n, n >= 0, with b(n) = A268924(n), n >= 0.
a(n) = - A271225(n)*2*A268924(n) (mod 3), n >= 1. Solution of the linear congruence given above in a comment. See, e.g., Nagell, Theorem 38 pp. 77-78.
A268924(n+1) = sum(a(k)*3^k, k=0..n), n >= 0.

A268924 One of the two successive approximations up to 3^n for the 3-adic integer sqrt(-2). These are the numbers congruent to 1 mod 3 (except for n = 0).

Original entry on oeis.org

0, 1, 4, 22, 22, 22, 508, 508, 2695, 2695, 2695, 2695, 356989, 888430, 4077076, 4077076, 18425983, 18425983, 147566146, 534986635, 534986635, 7508555437, 28429261843, 28429261843, 122572440670, 405001977151
Offset: 0

Views

Author

Wolfdieter Lang, Apr 05 2016

Keywords

Comments

The other approximation for the 3-adic integer sqrt(-2) with numbers 2 (mod 3) is given in A271222.
For the digits of this 3-adic integer sqrt(-2), that is the scaled first differences, see A271223. This 3-adic number has the digits read from the right to the left ...2202101200022211102201101021200010200211 = u.
The companion 3-adic number has digits ...20020121022200011120021121201022212022012 = -u. See A271224.
For details see the W. Lang link ``Note on a Recurrence or Approximation Sequences of p-adic Square Roots'' given under A268922, also for the Nagell reference and Hensel lifting. Here p = 3, b = 2, x_1 = 1 and z_1 = 1.

Examples

			n=2: 4^2 + 2 = 18 == 0 (mod 3^2), and 4 is the only solution from {0, 1, ..., 8} which is congruent to 1 modulo 3.
n=3: the only solution of  X^2 + 2 == 0 (mod 3^3) with X from {0, ..., 26} and X == 1 (mod 3) is 22. The number 5 = A271222(3)  also satisfies the first congruence but not the second one: 5  == 2 (mod 3).
n=4: the only solution of X^2 + 2 == 0 (mod 3^4) with X from {0, ..., 80} and X == 1 (mod 3) is also 22. The number 59 = A271222(4) also satisfies the first congruence but not the second one: 59  == 2 (mod 3).
		

References

  • Trygve Nagell, Introduction to Number Theory, Chelsea Publishing Company, New York, 1964, p. 87.

Crossrefs

Programs

  • Maple
    with(padic):D1:=op(3,op([evalp(RootOf(x^2+2),3,20)][1])): 0,seq(sum('D1[k]*3^(k-1)','k'=1..n), n=1..20);
    # alternative program based on the Lucas numbers L(3^n) = A006267(n)
    a := proc(n) option remember; if n = 1 then 1 else irem(a(n-1)^3 + 3*a(n-1), 3^n) end if; end: seq(a(n), n = 1..22); # Peter Bala, Nov 15 2022
  • PARI
    a(n) = truncate(sqrt(-2+O(3^(n)))); \\ Michel Marcus, Apr 09 2016
    
  • Python
    def a268924(n):
        ary=[0]
        a, mod = 1, 3
        for i in range(n):
              b=a%mod
              ary.append(b)
              a=b**2 + b + 2
              mod*=3
        return ary
    print(a268924(100)) # Indranil Ghosh, Aug 04 2017, after Ruby
  • Ruby
    def A268924(n)
      ary = [0]
      a, mod = 1, 3
      n.times{
        b = a % mod
        ary << b
        a = b * b + b + 2
        mod *= 3
      }
      ary
    end
    p A268924(100) # Seiichi Manyama, Aug 03 2017
    

Formula

a(n)^2 + 2 == 0 (mod 3^n), and a(n) == 1 (mod 3). Representatives of the complete residue system {0, 1, ..., 3^n-1} are taken.
Recurrence for n >= 1: a(n) = modp(a(n-1) + a(n-1)^2 + 2, 3^n), n >= 2, with a(1) = 1. Here modp(a, m) is used to pick the representative of the residue class a modulo m from the smallest nonnegative complete residue system {0, 1, ..., m-1}.
a(n) = 3^n - A271222(n), n >= 1.
a(n) == Lucas(3^n) (mod 3^n). - Peter Bala, Nov 10 2022

A271222 One of the two successive approximations up to 3^n for the 3-adic integer sqrt(-2). These are the numbers congruent to 2 mod 3 (except for the initial 0).

Original entry on oeis.org

0, 2, 5, 5, 59, 221, 221, 1679, 3866, 16988, 56354, 174452, 174452, 705893, 705893, 10271831, 24620738, 110714180, 239854343, 627274832, 2951797766, 2951797766, 2951797766, 65713916984, 159857095811, 442286632292
Offset: 0

Views

Author

Wolfdieter Lang, Apr 05 2016

Keywords

Comments

The other approximation for the 3-adic integer sqrt(-2) with numbers 1 (mod 3) is given in A268924.
For the digits of this 3-adic integer sqrt(-2), that is the scaled first differences, see A271224. This 3-adic number has the digits read from the right to the left ... 20020121022200011120021121201022212022012 = -u. For the digits of u see A271223.
For details see the W. Lang link ``Note on a Recurrence or Approximation Sequences of p-adic Square Roots'' given under A268922, also for the Nagell reference and Hensel lifting. Here p = 3, b = 2, x_2 = 2 and z_2 = 2.

Examples

			n=2: 5^2 + 2 = 27 == 0 (mod 3^2), and 5 is the only solution from {0, 1, ..., 8} which is congruent to 2 modulo 3.
n=3: the only solution of X^2 + 2 == 0 (mod 3^3) with X from {0, ..., 26} and X == 2(mod 3) is 5. The number 22 = A268924(3) also satisfies the first congruence but not the second one: 22  == 1 (mod 3).
n=4: the only solution of X^2 + 2 == 0 (mod 3^4) with X from {0, ..., 80} and X == 2 (mod 3) is 59. The number 22 = A268924(4) also satisfies the first congruence but not the second one: 59  == 1 (mod 3).
		

References

  • Trygve Nagell, Introduction to Number Theory, Chelsea Publishing Company, New York, 1964, p. 87.

Crossrefs

Programs

  • Maple
    with(padic):D2:=op(3,op([evalp(RootOf(x^2+2),3,20)][2])): 0,seq(sum('D2[k]*3^(k-1)','k'=1..n), n=1..20);
  • PARI
    a(n) = if (n, 3^n - truncate(sqrt(-2+O(3^(n)))), 0); \\ Michel Marcus, Apr 09 2016
    
  • Python
    def a271222(n):
          ary=[0]
          a, mod = 2, 3
          for i in range(n):
              b=a%mod
              ary.append(b)
              a=2*b**2 + b + 4
              mod*=3
          return ary
    print(a271222(100)) # Indranil Ghosh, Aug 04 2017, after Ruby
  • Ruby
    def A271222(n)
      ary = [0]
      a, mod = 2, 3
      n.times{
        b = a % mod
        ary << b
        a = 2 * b * b + b + 4
        mod *= 3
      }
      ary
    end
    p A271222(100) # Seiichi Manyama, Aug 03 2017
    

Formula

a(n)^2 + 2 == 0 (mod 3^n), and a(n) == 2 (mod 3). Representatives of the complete residue system {0, 1, ..., 3^n-1} are taken.
Recurrence for n >= 1: a(n) = modp(a(n-1) + 2*(a(n-1)^2 + 2), 3^n), n >= 2, with a(1) = 2. Here modp(a, m) is used to pick the representative of the residue class a modulo m from the smallest nonnegative complete residue system {0, 1, ... , m-1}.
a(n) = 3^n - A268924(n), n >= 1.
a(n) == A002203(3^n) (mod 3^n). - Peter Bala, Nov 10 2022

A318962 Digits of one of the two 2-adic integers sqrt(-7) that ends in 01.

Original entry on oeis.org

1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1
Offset: 0

Views

Author

Jianing Song, Sep 06 2018

Keywords

Comments

Over the 2-adic integers there are 2 solutions to x^2 = -7, one ends in 01 and the other ends in 11. This sequence gives the former one. See A318960 for detailed information.

Examples

			...10110001110011100100110001100000010110101.
		

Crossrefs

Cf. A318960.
Digits of p-adic integers:
this sequence, A318963 (2-adic, sqrt(-7));
A271223, A271224 (3-adic, sqrt(-2));
A269591, A269592 (5-adic, sqrt(-4));
A210850, A210851 (5-adic, sqrt(-1));
A290566 (5-adic, 2^(1/3));
A290563 (5-adic, 3^(1/3));
A290794, A290795 (7-adic, sqrt(-6));
A290798, A290799 (7-adic, sqrt(-5));
A290796, A290797 (7-adic, sqrt(-3));
A212152, A212155 (7-adic, (1+sqrt(-3))/2);
A051277, A290558 (7-adic, sqrt(2));
A286838, A286839 (13-adic, sqrt(-1));
A309989, A309990 (17-adic, sqrt(-1)).
Also there are numerous sequences related to digits of 10-adic integers.

Programs

  • PARI
    a(n) = truncate(-sqrt(-7+O(2^(n+2))))\2^n

Formula

a(0) = 1, a(1) = 0; for n >= 2, a(n) = 0 if A318960(n)^2 + 7 is divisible by 2^(n+2), otherwise 1.
a(n) = 1 - A318963(n) for n >= 1.
For n >= 2, a(n) = (A318960(n+1) - A318960(n))/2^n.

Extensions

Corrected by Jianing Song, Aug 28 2019

A318963 Digits of one of the two 2-adic integers sqrt(-7) that ends in 11.

Original entry on oeis.org

1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0
Offset: 0

Views

Author

Jianing Song, Sep 06 2018

Keywords

Comments

Over the 2-adic integers there are 2 solutions to x^2 = -7, one ends in 01 and the other ends in 11. This sequence gives the latter one. See A318961 for detailed information.

Examples

			...01001110001100011011001110011111101001011.
		

Crossrefs

Cf. A318961.
Digits of p-adic integers:
A318962, this sequence (2-adic, sqrt(-7));
A271223, A271224 (3-adic, sqrt(-2));
A269591, A269592 (5-adic, sqrt(-4));
A210850, A210851 (5-adic, sqrt(-1));
A290566 (5-adic, 2^(1/3));
A290563 (5-adic, 3^(1/3));
A290794, A290795 (7-adic, sqrt(-6));
A290798, A290799 (7-adic, sqrt(-5));
A290796, A290797 (7-adic, sqrt(-3));
A212152, A212155 (7-adic, (1+sqrt(-3))/2);
A051277, A290558 (7-adic, sqrt(2));
A286838, A286839 (13-adic, sqrt(-1));
A309989, A309990 (17-adic, sqrt(-1)).
Also there are numerous sequences related to digits of 10-adic integers.

Programs

  • PARI
    a(n) = if(n==1, 1, truncate(sqrt(-7+O(2^(n+2))))\2^n)

Formula

a(0) = a(1) = 1; for n >= 2, a(n) = 0 if A318961(n)^2 + 7 is divisible by 2^(n+2), otherwise 1.
a(n) = 1 - A318962(n) for n >= 1.
For n >= 2, a(n) = (A318961(n+1) - A318961(n))/2^n.

Extensions

Corrected by Jianing Song, Aug 28 2019

A309989 Digits of one of the two 17-adic integers sqrt(-1).

Original entry on oeis.org

4, 2, 10, 5, 12, 16, 12, 8, 13, 3, 14, 0, 6, 1, 0, 15, 1, 8, 14, 5, 7, 16, 14, 1, 5, 13, 9, 6, 5, 12, 16, 15, 9, 16, 14, 12, 16, 1, 3, 6, 4, 10, 15, 5, 16, 12, 2, 1, 5, 4, 0, 15, 2, 11, 14, 9, 5, 1, 11, 16, 15, 7, 5, 6, 14, 3, 12, 0, 0, 11, 12, 13, 9, 5, 4, 16, 13
Offset: 0

Views

Author

Jianing Song, Aug 26 2019

Keywords

Comments

This square root of -1 in the 17-adic field ends with digit 4. The other, A309990, ends with digit 13 (D when written as a 17-adic number).

Examples

			The solution to x^2 == -1 (mod 17^4) such that x == 4 (mod 17) is x == 27493 (mod 17^4), and 27493 is written as 5A24 in heptadecimal, so the first four terms are 4, 2, 10 and 5.
		

Crossrefs

Digits of p-adic square roots:
A318962, A318963 (2-adic, sqrt(-7));
A271223, A271224 (3-adic, sqrt(-2));
A269591, A269592 (5-adic, sqrt(-4));
A210850, A210851 (5-adic, sqrt(-1));
A290794, A290795 (7-adic, sqrt(-6));
A290798, A290799 (7-adic, sqrt(-5));
A290796, A290797 (7-adic, sqrt(-3));
A051277, A290558 (7-adic, sqrt(2));
A321074, A321075 (11-adic, sqrt(3));
A321078, A321079 (11-adic, sqrt(5));
A322091, A322092 (13-adic, sqrt(-3));
A286838, A286839 (13-adic, sqrt(-1));
A322087, A322088 (13-adic, sqrt(3));
this sequence, A309990 (17-adic, sqrt(-1)).

Programs

  • PARI
    a(n) = truncate(sqrt(-1+O(17^(n+1))))\17^n

Formula

a(n) = (A286877(n+1) - A286877(n))/17^n.
For n > 0, a(n) = 16 - A309990(n).

A309990 Digits of one of the two 17-adic integers sqrt(-1).

Original entry on oeis.org

13, 14, 6, 11, 4, 0, 4, 8, 3, 13, 2, 16, 10, 15, 16, 1, 15, 8, 2, 11, 9, 0, 2, 15, 11, 3, 7, 10, 11, 4, 0, 1, 7, 0, 2, 4, 0, 15, 13, 10, 12, 6, 1, 11, 0, 4, 14, 15, 11, 12, 16, 1, 14, 5, 2, 7, 11, 15, 5, 0, 1, 9, 11, 10, 2, 13, 4, 16, 16, 5, 4, 3, 7, 11, 12, 0
Offset: 0

Views

Author

Jianing Song, Aug 26 2019

Keywords

Comments

This square root of -1 in the 17-adic field ends with digit 13 (D when written as a 17-adic number). The other, A309989, ends with digit 4.

Examples

			The solution to x^2 == -1 (mod 17^4) such that x == 13 (mod 17) is x == 56028 (mod 17^4), and 56028 is written as B6ED in heptadecimal, so the first four terms are 13, 14, 6 and 11.
		

Crossrefs

Digits of p-adic square roots:
A318962, A318963 (2-adic, sqrt(-7));
A271223, A271224 (3-adic, sqrt(-2));
A269591, A269592 (5-adic, sqrt(-4));
A210850, A210851 (5-adic, sqrt(-1));
A290794, A290795 (7-adic, sqrt(-6));
A290798, A290799 (7-adic, sqrt(-5));
A290796, A290797 (7-adic, sqrt(-3));
A051277, A290558 (7-adic, sqrt(2));
A321074, A321075 (11-adic, sqrt(3));
A321078, A321079 (11-adic, sqrt(5));
A322091, A322092 (13-adic, sqrt(-3));
A286838, A286839 (13-adic, sqrt(-1));
A322087, A322088 (13-adic, sqrt(3));
A309989, this sequence (17-adic, sqrt(-1)).

Programs

  • PARI
    a(n) = truncate(-sqrt(-1+O(17^(n+1))))\17^n

Formula

a(n) = (A286878(n+1) - A286878(n))/17^n.
For n > 0, a(n) = 16 - A309989(n).

A309475 Digits of one of the two 3-adic integers sqrt(-1/2). Here the sequence with first digit 2.

Original entry on oeis.org

2, 0, 1, 0, 0, 1, 0, 2, 1, 1, 1, 2, 0, 1, 0, 2, 1, 0, 2, 1, 2, 2, 1, 0, 2, 0, 1, 1, 1, 0, 0, 0, 1, 2, 1, 0, 1, 0, 1, 1, 0, 1, 0, 2, 2, 1, 0, 1, 1, 1, 2, 1, 2, 1, 0, 1, 0, 1, 0, 0, 2, 0, 1, 2, 1, 0, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 0, 2, 0, 1, 1, 0, 2, 0, 2, 0, 2, 0, 0, 2, 0, 0, 2, 2, 2, 1, 0, 2, 2, 2
Offset: 0

Views

Author

Seiichi Manyama, Aug 04 2019

Keywords

Crossrefs

Programs

  • Maple
    T:= select(t -> padic:-ratvaluep(t, 1)=2, [padic:-rootp(x^2+1/2, 3, 100)]): op([1, 1, 3], T); # Robert Israel, Aug 05 2019
  • PARI
    Vecrev(digits(truncate(-sqrt(-1/2+O(3^100))), 3))

Formula

p = ...100102, p^2 = ...111111.
q = A271224 = ...022012, p * q = ...000001.
a(n) = (b(n+1) - b(n))/3^n, with b(n) = A309477(n).

A271226 a(n) = (A271222(n)^2 + 2)/3^n, n >= 0.

Original entry on oeis.org

2, 2, 3, 1, 43, 201, 67, 1289, 2278, 14662, 53782, 171798, 57266, 312537, 104179, 7353209, 14081926, 94917254, 148495259, 338541478, 2498895558, 832965186, 277655062, 45869694854, 90480235883, 230874654662
Offset: 0

Views

Author

Wolfdieter Lang, Apr 05 2016

Keywords

Comments

a(n) is an integer because b(n) = A271222(n) satisfies b(n)^2 + 2 == 0 (mod 3^n), n >= 0.
See A268924 for details, links and references.

Examples

			a(0) = (0^2 + 2)/1 = 2.
a(4) = (59^2 + 2)/3^4 = 43.
		

Crossrefs

Cf. A268924, A271222, A271224, A271225 (companion sequence).

Programs

  • PARI
    b(n) = if (n, 3^n - truncate(sqrt(-2+O(3^(n)))), 0);
    a(n) = (b(n)^2 + 2)/3^n; \\ Michel Marcus, Apr 09 2016

Formula

a(n) = (b(n)^2 + 2)/3^n, n >= 0, with b(n) = A271222(n).
Showing 1-10 of 10 results.