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.
%I A271222 #38 Nov 29 2022 12:27:22 %S A271222 0,2,5,5,59,221,221,1679,3866,16988,56354,174452,174452,705893,705893, %T A271222 10271831,24620738,110714180,239854343,627274832,2951797766, %U A271222 2951797766,2951797766,65713916984,159857095811,442286632292 %N 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). %C A271222 The other approximation for the 3-adic integer sqrt(-2) with numbers 1 (mod 3) is given in A268924. %C A271222 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. %C A271222 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. %D A271222 Trygve Nagell, Introduction to Number Theory, Chelsea Publishing Company, New York, 1964, p. 87. %H A271222 Seiichi Manyama, <a href="/A271222/b271222.txt">Table of n, a(n) for n = 0..2095</a> %H A271222 Peter Bala, <a href="/A268924/a268924.pdf">A note on A268924 and A271222</a>, Nov 28 2022. %H A271222 Wikipedia, <a href="https://en.wikipedia.org/wiki/Hensel%27s_lemma">Hensel's Lemma</a>. %F A271222 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. %F A271222 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}. %F A271222 a(n) = 3^n - A268924(n), n >= 1. %F A271222 a(n) == A002203(3^n) (mod 3^n). - _Peter Bala_, Nov 10 2022 %e A271222 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. %e A271222 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). %e A271222 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). %p A271222 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); %o A271222 (PARI) a(n) = if (n, 3^n - truncate(sqrt(-2+O(3^(n)))), 0); \\ _Michel Marcus_, Apr 09 2016 %o A271222 (Ruby) %o A271222 def A271222(n) %o A271222 ary = [0] %o A271222 a, mod = 2, 3 %o A271222 n.times{ %o A271222 b = a % mod %o A271222 ary << b %o A271222 a = 2 * b * b + b + 4 %o A271222 mod *= 3 %o A271222 } %o A271222 ary %o A271222 end %o A271222 p A271222(100) # _Seiichi Manyama_, Aug 03 2017 %o A271222 (Python) %o A271222 def a271222(n): %o A271222 ary=[0] %o A271222 a, mod = 2, 3 %o A271222 for i in range(n): %o A271222 b=a%mod %o A271222 ary.append(b) %o A271222 a=2*b**2 + b + 4 %o A271222 mod*=3 %o A271222 return ary %o A271222 print(a271222(100)) # _Indranil Ghosh_, Aug 04 2017, after Ruby %Y A271222 Cf. A002293, A268922, A268924, A271223, A271224. %K A271222 nonn,easy %O A271222 0,2 %A A271222 _Wolfdieter Lang_, Apr 05 2016