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 A268924 #43 Nov 29 2022 11:52:50 %S A268924 0,1,4,22,22,22,508,508,2695,2695,2695,2695,356989,888430,4077076, %T A268924 4077076,18425983,18425983,147566146,534986635,534986635,7508555437, %U A268924 28429261843,28429261843,122572440670,405001977151 %N 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). %C A268924 The other approximation for the 3-adic integer sqrt(-2) with numbers 2 (mod 3) is given in A271222. %C A268924 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. %C A268924 The companion 3-adic number has digits ...20020121022200011120021121201022212022012 = -u. See A271224. %C A268924 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. %D A268924 Trygve Nagell, Introduction to Number Theory, Chelsea Publishing Company, New York, 1964, p. 87. %H A268924 Seiichi Manyama, <a href="/A268924/b268924.txt">Table of n, a(n) for n = 0..2096</a> %H A268924 Peter Bala, <a href="/A268924/a268924.pdf">A note on A268924 and A271222</a>, Nov 28 2022. %H A268924 Wikipedia, <a href="https://en.wikipedia.org/wiki/Hensel%27s_lemma">Hensel's Lemma</a>. %F A268924 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. %F A268924 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}. %F A268924 a(n) = 3^n - A271222(n), n >= 1. %F A268924 a(n) == Lucas(3^n) (mod 3^n). - _Peter Bala_, Nov 10 2022 %e A268924 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. %e A268924 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). %e A268924 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). %p A268924 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); %p A268924 # alternative program based on the Lucas numbers L(3^n) = A006267(n) %p A268924 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 %o A268924 (PARI) a(n) = truncate(sqrt(-2+O(3^(n)))); \\ _Michel Marcus_, Apr 09 2016 %o A268924 (Ruby) %o A268924 def A268924(n) %o A268924 ary = [0] %o A268924 a, mod = 1, 3 %o A268924 n.times{ %o A268924 b = a % mod %o A268924 ary << b %o A268924 a = b * b + b + 2 %o A268924 mod *= 3 %o A268924 } %o A268924 ary %o A268924 end %o A268924 p A268924(100) # _Seiichi Manyama_, Aug 03 2017 %o A268924 (Python) %o A268924 def a268924(n): %o A268924 ary=[0] %o A268924 a, mod = 1, 3 %o A268924 for i in range(n): %o A268924 b=a%mod %o A268924 ary.append(b) %o A268924 a=b**2 + b + 2 %o A268924 mod*=3 %o A268924 return ary %o A268924 print(a268924(100)) # _Indranil Ghosh_, Aug 04 2017, after Ruby %Y A268924 Cf. A000032, A006267, A268922, A271222, A271223, A271224. %K A268924 nonn,easy %O A268924 0,3 %A A268924 _Wolfdieter Lang_, Apr 05 2016