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 24 results. Next

A269593 a(n) = (A268922(n)^2 + 4)/5^n, n >= 0.

Original entry on oeis.org

4, 1, 5, 1, 109, 1460, 292, 53476, 124904, 993169, 5385572, 43930532, 239139524, 777233593, 789206948, 2256445369, 65340851012, 661111023620, 132222204724, 7745142596633, 10225443529556, 103321258570120, 20664251714024, 4562022446935993, 6246398287209928, 20888388201358465
Offset: 0

Views

Author

Wolfdieter Lang, Mar 02 2016

Keywords

Comments

a(n) is an integer because b(n) = A268922(n) satisfies b(n)^2 + 4 == 0 (mod 5^n), n>=0.
See A268922 for details and references.

Examples

			a(0) = (0 + 4)/1 = 4.
a(4) = (261^2 + 4)/5^4 = 109.
		

Crossrefs

Cf. A268922, A269590, A269594 (companion sequence).

Programs

  • PARI
    a(n) = ((truncate(sqrt(-4+O(5^(n)))))^2 + 4)/5^n; \\ Michel Marcus, Mar 07 2016

Formula

a(n) = (b(n)^2 + 1)/5^n, n>=0, with b(n) = A268922(n).

Extensions

Terms a(21) and beyond from Andrew Howroyd, Mar 02 2020

A048898 One of the two successive approximations up to 5^n for the 5-adic integer sqrt(-1).

Original entry on oeis.org

0, 2, 7, 57, 182, 2057, 14557, 45807, 280182, 280182, 6139557, 25670807, 123327057, 123327057, 5006139557, 11109655182, 102662389557, 407838170807, 3459595983307, 3459595983307, 79753541295807, 365855836217682, 2273204469030182, 2273204469030182, 49956920289342682
Offset: 0

Views

Author

Michael Somos, Jul 26 1999

Keywords

Comments

This is the root congruent to 2 mod 5.
Or, residues modulo 5^n of a 5-adic solution of x^2+1=0.
The radix-5 expansion of a(n) is obtained from the n rightmost digits in the expansion of the following pentadic integer:
...422331102414131141421404340423140223032431212 = u
The residues modulo 5^n of the other 5-adic solution of x^2+1=0 are given by A048899 which corresponds to the pentadic integer -u:
...022113342030313303023040104021304221412013233 = -u
The digits of u and -u are given in A210850 and A210851, respectively. - Wolfdieter Lang, May 02 2012
For approximations for p-adic square roots see also the W. Lang link under A268922. - Wolfdieter Lang, Apr 03 2016
From Jianing Song, Sep 06 2022: (Start)
For n > 0, a(n)-1 is one of the four solutions to x^4 == -4 (mod 5^n), the one that is congruent to 1 modulo 5.
For n > 0, a(n)+1 is one of the four solutions to x^4 == -4 (mod 5^n), the one that is congruent to 3 modulo 5. (End)

Examples

			a(0)=0 because 0 satisfies any equation in integers modulo 1.
a(1)=2 because 2 is one solution of x^2+1=0 modulo 5. (The other solution is 3, which gives rise to A048899.)
a(2)=7 because the equation (5y+a(1))^2+1=0 modulo 25 means that y is 1 modulo 5.
		

References

  • J. H. Conway, The Sensual Quadratic Form, p. 118, Mathematical Association of America, 1997, The Carus Mathematical Monographs, Number 26.
  • K. Mahler, Introduction to p-Adic Numbers and Their Functions, Cambridge, 1973, p. 35.

Crossrefs

The two successive approximations up to p^n for p-adic integer sqrt(-1): this sequence and A048899 (p=5), A286840 and A286841 (p=13), A286877 and A286878 (p=17).
Cf. A000351 (powers of 5), A034939(n) = Min(a(n), A048899(n)).
Different from A034935.

Programs

  • Magma
    [n le 2 select 2*(n-1) else Self(n-1)^5 mod 5^(n-1): n in [1..30]]; // Vincenzo Librandi, Feb 29 2016
  • Mathematica
    a[0] = 0; a[1] = 2; a[n_] := a[n] = Mod[a[n-1]^5, 5^n]; Table[a[n], {n, 0, 21}] (* Jean-François Alcover, Nov 24 2011, after PARI *)
    Join[{0}, RecurrenceTable[{a[1] == 2, a[n] == Mod[a[n-1]^5, 5^n]}, a, {n, 25}]] (* Vincenzo Librandi, Feb 29 2016 *)
  • PARI
    {a(n) = if( n<2, 2, a(n-1)^5) % 5^n}
    
  • PARI
    a(n) = lift(sqrt(-1 + O(5^n))); \\ Kevin Ryde, Dec 22 2020
    

Formula

If n>0, a(n) = 5^n - A048899(n).
From Wolfdieter Lang, Apr 28 2012: (Start)
Recurrence: a(n) = a(n-1)^5 (mod 5^n), a(1) = 2, n>=2. See the J.-F. Alcover Mathematica program and the PARI program below.
a(n) == 2^(5^(n-1)) (mod 5^n), n>=1.
a(n)*a(n-1) + 1 == 0 (mod 5^(n-1)), n>=1.
(a(n)^2 + 1)/5^n = A210848(n), n>=0.
(End)
Another recurrence: a(n) = modp(a(n-1) + a(n-1)^2 + 1, 5^n), n >= 2, a(1) = 2. Here modp(a, m) is the representative from {0, 1, ..., |m|-1} of the residue class a modulo m. Note that a(n) is in the residue class of a(n-1) modulo 5^(n-1) (see Hensel lifting). - Wolfdieter Lang, Feb 28 2016
a(n) == L(5^n,2) (mod 5^n), where L(n,x) denotes the n-th Lucas polynomial of A114525. - Peter Bala, Nov 20 2022

Extensions

Additional comments from Gerard P. Michon, Jul 15 2009
Edited by N. J. A. Sloane, Jul 25 2009
Name clarified by Wolfdieter Lang, Feb 19 2016

A269591 Digits of one of the two 5-adic integers sqrt(-4).

Original entry on oeis.org

1, 2, 0, 2, 3, 0, 4, 2, 3, 3, 4, 4, 3, 1, 1, 3, 4, 0, 3, 1, 2, 0, 3, 1, 1, 0, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 4, 3, 2, 2, 3, 2, 4, 4, 0, 3, 1, 4, 0, 3, 3, 1, 0, 1, 3, 3, 2, 3, 3, 3, 4, 4, 3, 1, 3, 1
Offset: 0

Views

Author

Wolfdieter Lang, Mar 02 2016

Keywords

Comments

This is the scaled first difference sequence of A268922.
The digits of the other 5-adic integer sqrt(-4), are given in A269592. See also A268922 for the two 5-adic numbers sqrt(-4), called u and -u.
a(n) is the unique solution of the linear congruence 2*A268922(n)*a(n) + A269593(n) == 0 (mod 5), n>=1. Therefore only the values 0, 1, 2, 3 and 4 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.

Examples

			a(4) = 3 because 2*261*3 + 109 = 1675 == 0 (mod 5).
a(4) = - 109*(2*261)^3 (mod 5) = -(-1)*(2*1)^3 (mod 5) = 8 (mod 5) = 3.
A268922(5) = 2136 = 1*5^0 + 2*5^1 + 0*5^2 + 2*5^3 + 3*5^4.
		

Crossrefs

Cf. A210850, A210851, A268922, A269592 (companion), A269593.

Programs

  • PARI
    a(n) = truncate(sqrt(-4+O(5^(n+1))))\5^n; \\ Michel Marcus, Mar 04 2016

Formula

a(n) = (b(n+1) - b(n))/5^n, n >= 0, with b(n) = A268922(n), n >= 0.
a(n) = -A269593(n)*(2*A268922(n))^3 (mod 5), n >= 1. Solution of the linear congruence see, e.g., Nagell, Theorem 38 pp. 77-78.
A268922(n+1) = sum(a(k)*5^k, k=0..n), n >= 0.

A269592 Digits of one of the two 5-adic integers sqrt(-4). Here the ones related to A269590.

Original entry on oeis.org

4, 2, 4, 2, 1, 4, 0, 2, 1, 1, 0, 0, 1, 3, 3, 1, 0, 4, 1, 3, 2, 4, 1, 3, 3, 4, 3, 3, 3, 3, 2, 1, 3, 3, 3, 3, 0, 1, 2, 2, 1, 2, 0, 0, 4, 1, 3, 0, 4, 1, 1, 3, 4, 3, 1, 1, 2, 1, 1, 1, 0, 0, 1, 3, 1, 3
Offset: 0

Views

Author

Wolfdieter Lang, Mar 02 2016

Keywords

Comments

This is the scaled first difference sequence of A269590.
The digits of the other 5-adic integer sqrt(-4), are given in A269591. See also A268922 for the two 5-adic numbers -u and u.
a(n) is the unique solution of the linear congruence 2*A269590(n)*a(n) + A269594(n) == 0 (mod 5), n>=1. Therefore only the values 0, 1, 2, 3 and 4 appear. See the Nagell reference given in A268922, eq. (6) on p. 86, adapted to this case. a(0) = 4 follows from the formula given below.

Examples

			a(4) = -212*(2*364)^3 (mod 5) = -2*(2*(-1))^3 (mod 5) = 1.
		

Crossrefs

Cf. A269590, A269591 (companion), A269594.

Programs

  • PARI
    a(n) = truncate(-sqrt(-4+O(5^(n+1))))\5^n; \\ Michel Marcus, Mar 04 2016

Formula

a(n) = (b(n+1) - b(n))/5^n, n>=0, with b(n) = A269590(n), n >= 0.
a(n) = -A269594(n)*(2*A269590(n))^3 (mod 5), n >= 1. Solution of the linear congruence see, e.g., Nagell, Theorem 38 pp. 77-78.
A269590(n+1) = sum(a(k)*5^k, k=0..n), n>=0.
a(n) = 4 - A269591(n) if n > 0 and a(0) = 5 - A269591(0) = 5-4 = 1. - Michel Marcus, Mar 31 2016

A269590 One of the two successive approximations up to 5^n for the 5-adic integer sqrt(-4). These are the 4 mod 5 numbers (except for n=0).

Original entry on oeis.org

0, 4, 14, 114, 364, 989, 13489, 13489, 169739, 560364, 2513489, 2513489, 2513489, 246654114, 3908763489, 22219310364, 52736888489, 52736888489, 3104494700989, 6919191966614
Offset: 0

Views

Author

Wolfdieter Lang, Mar 02 2016

Keywords

Comments

The other approximation for the 5-adic integer sqrt(-4) with numbers 1 (mod 5) is given in A268922. See this also for more details and references.
For the digits of this 5-adic integer sqrt(-4), that is the scaled first differences, see A269592. See also A268922 for the 5-adic numbers u and -u written from the right to the left.

Crossrefs

Programs

  • Maple
    with(padic): D2:=op(3,op([evalp(RootOf(x^2+4),5,20)][2])):
    0,seq(sum('D2[k]*5^(k-1)','k'=1..n),n=1..20);
    # alternative program
    a := proc(n) option remember; if n = 1 then 4 else irem( a(n-1)^5 + 5*a(n-1)^3 + 5*a(n-1), 5^n) end if; end: seq(a(n), n = 1..20); # Peter Bala, Nov 14 2022
  • PARI
    a(n) = if (n==0, 0, 5^n - truncate(sqrt(-4+O(5^(n))))); \\ Michel Marcus, Mar 07 2016

Formula

Recurrence for n >= 1: a(n) = modp( a(n-1) + 3*(a(n-1)^2 + 4), 5^n), n >= 2, with a(1) = 4. 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) = 5^n - A268922(n), n >= 1.
a(n) == Lucas(3*(5^n)) (mod 5^n). - Peter Bala, Nov 14 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

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

Original entry on oeis.org

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

Views

Author

Wolfdieter Lang, Apr 05 2016

Keywords

Comments

This is the scaled first difference sequence of A271222. See the formula.
The digits of the other 3-adic integer sqrt(-2), are given in A271223. See also a comment on 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*A271222(n)*a(n) + A271226(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) = 2 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 A002203(3^k) = A006266(k) give the first k terms of the sequence. - Peter Bala, Nov 26 2022

Examples

			a(4) = 2 because 2*59*2 + 43 = 279 == 0 (mod 3).
a(4) = - 43*(2*59) (mod 3) = -1*(2*(-1)) (mod 3) = 2.
A271222(5) = 221  = 2*3^0 + 1*3^1 + 0*3^2 + 2*3^3 + 2*3^4.
		

References

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

Crossrefs

Cf. A268924, A268992, A271222, A271226, A271223 (companion).

Programs

  • 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) = A271222(n), n >= 0.
a(n) = - A271226(n)*2*A271222(n) (mod 3), n >= 1. Solution of the linear congruence given above in a comment. See, e.g., Nagell, Theorem 38 pp. 77-78.
A271222(n+1) = sum(a(k)*3^k, k=0..n), n >= 0.

A309444 The successive approximations up to 5^n for 5-adic integer 4^(1/3).

Original entry on oeis.org

0, 4, 9, 59, 559, 3059, 12434, 59309, 371809, 371809, 8184309, 27715559, 76543684, 320684309, 1541387434, 25955449934, 86990606184, 392166387434, 2680984746809, 14125076543684, 52272049199934, 338374344121809, 2245722976934309, 7014094558965559, 42776881424199934
Offset: 0

Views

Author

Seiichi Manyama, Aug 03 2019

Keywords

Examples

			a(1) = (   4)_5 = 4,
a(2) = (  14)_5 = 9,
a(3) = ( 214)_5 = 59,
a(4) = (4214)_5 = 559.
		

Crossrefs

Cf. A309443.
Expansions of p-adic integers:
A268922, A269590 (5-adic, sqrt(-4));
A048898, A048899 (5-adic, sqrt(-1));
A290567 (5-adic, 2^(1/3));
A290568 (5-adic, 3^(1/3)).

Programs

  • PARI
    {a(n) = truncate((4+O(5^n))^(1/3))}

Formula

a(0) = 0 and a(1) = 4, a(n) = a(n-1) + 3 * (a(n-1)^3 - 4) mod 5^n for n > 1.

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
Showing 1-10 of 24 results. Next