%I #48 Dec 04 2022 13:06:28
%S 0,8,99,1958,28322,228249,2827300,55922199,808904403,9781942334,
%T 52199939826,603633907222,11356596271444,11356596271444,
%U 1828607235824962,37264994707118563,651495710876207647,5974828584341646375,49226908181248336040
%N One of the two successive approximations up to 13^n for 13-adic integer sqrt(-1). Here the 8 (mod 13) case (except for n=0).
%H Seiichi Manyama, <a href="/A286841/b286841.txt">Table of n, a(n) for n = 0..899</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Hensel%27s_lemma">Hensel's Lemma</a>.
%F If n > 0, a(n) = 13^n - A286840(n).
%F a(0) = 0 and a(1) = 8, a(n) = a(n-1) + 4 * (a(n-1)^2 + 1) mod 13^n for n > 1.
%F a(n) == L(13^n,8) (mod 13^n) == (4 + sqrt(17))^(13^n) + (4 - sqrt(17))^(13^n) (mod 13^n), where L(n,x) denotes the n-th Lucas polynomial of A114525. - _Peter Bala_, Nov 20 2022
%t {0}~Join~Table[#&@@Select[PowerModList[-1, 1/2, 13^k], Mod[#, 13] == 8 &], {k, 18}] (* _Giorgos Kalogeropoulos_, Oct 22 2022 *)
%o (Ruby)
%o def A(k, m, n)
%o ary = [0]
%o a, mod = k, m
%o n.times{
%o b = a % mod
%o ary << b
%o a = b ** m
%o mod *= m
%o }
%o ary
%o end
%o def A286841(n)
%o A(8, 13, n)
%o end
%o p A286841(100)
%o (Python)
%o def A(k, m, n):
%o ary=[0]
%o a, mod = k, m
%o for i in range(n):
%o b=a%mod
%o ary.append(b)
%o a=b**m
%o mod*=m
%o return ary
%o def a286841(n):
%o return A(8, 13, n)
%o print(a286841(100)) # _Indranil Ghosh_, Aug 03 2017, after Ruby
%o (PARI) a(n) = if (n, 13^n - truncate(sqrt(-1+O(13^n))), 0); \\ _Michel Marcus_, Aug 04 2017
%Y The two successive approximations up to p^n for p-adic integer sqrt(-1): A048898 and A048899 (p=5), A286840 and this sequence (p=13), A286877 and A286878 (p=17).
%Y Cf. A114525, A286839.
%K nonn,easy
%O 0,2
%A _Seiichi Manyama_, Aug 01 2017