%I #45 Dec 04 2022 13:06:33
%S 0,5,70,239,239,143044,1999509,6826318,6826318,822557039,85658552023,
%T 1188526486815,11941488851037,291518510320809,2108769149874327,
%U 13920898306972194,13920898306972194,2675587335039691558,63228498770709057089,513050126578538629605
%N One of the two successive approximations up to 13^n for 13-adic integer sqrt(-1). Here the 5 (mod 13) case (except for n=0).
%H Seiichi Manyama, <a href="/A286840/b286840.txt">Table of n, a(n) for n = 0..897</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Hensel%27s_lemma">Hensel's Lemma</a>.
%F a(0) = 0 and a(1) = 5, a(n) = a(n-1) + 9 * (a(n-1)^2 + 1) mod 13^n for n > 1.
%F a(n) == L(13^n,5) (mod 13^n) == ((5 + sqrt(29))/2)^(13^n) + ((5 - sqrt(29))/2)^(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] == 5 &], {k, 20}] (* _Giorgos Kalogeropoulos_, Oct 21 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 A286840(n)
%o A(5, 13, n)
%o end
%o p A286840(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 a286840(n):
%o return A(5, 13, n)
%o print(a286840(100)) # _Indranil Ghosh_, Aug 03 2017, after Ruby
%o (PARI) a(n) = truncate(sqrt(-1+O(13^n))); \\ _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), this sequence and A286841 (p=13), A286877 and A286878 (p=17).
%Y Cf. A034944, A114525, A286838.
%K nonn,easy
%O 0,2
%A _Seiichi Manyama_, Aug 01 2017
|