OFFSET
0,2
LINKS
Seiichi Manyama, Table of n, a(n) for n = 0..899
Wikipedia, Hensel's Lemma.
FORMULA
If n > 0, a(n) = 13^n - A286840(n).
a(0) = 0 and a(1) = 8, a(n) = a(n-1) + 4 * (a(n-1)^2 + 1) mod 13^n for n > 1.
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
MATHEMATICA
{0}~Join~Table[#&@@Select[PowerModList[-1, 1/2, 13^k], Mod[#, 13] == 8 &], {k, 18}] (* Giorgos Kalogeropoulos, Oct 22 2022 *)
PROG
(Ruby)
def A(k, m, n)
ary = [0]
a, mod = k, m
n.times{
b = a % mod
ary << b
a = b ** m
mod *= m
}
ary
end
def A286841(n)
A(8, 13, n)
end
p A286841(100)
(Python)
def A(k, m, n):
ary=[0]
a, mod = k, m
for i in range(n):
b=a%mod
ary.append(b)
a=b**m
mod*=m
return ary
def a286841(n):
return A(8, 13, n)
print(a286841(100)) # Indranil Ghosh, Aug 03 2017, after Ruby
(PARI) a(n) = if (n, 13^n - truncate(sqrt(-1+O(13^n))), 0); \\ Michel Marcus, Aug 04 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Seiichi Manyama, Aug 01 2017
STATUS
approved