OFFSET
0,2
LINKS
Zak Seidov, Table of n, a(n) for n = 0..100
MATHEMATICA
b=2; n5=5; jo=Join[{0, b}, Table[n5=5*n5; b=PowerMod[b, 5, n5]; b=Min[b, n5-b], {99}]] (* Zak Seidov, Nov 04 2011 *)
Table[x/.FindInstance[Mod[x^2+1, 5^n]==0, x, Integers][[1]], {n, 0, 25}] (* Harvey P. Dale, Jul 04 2017 *)
PROG
(PARI) b(n)=if(n<2, 2, b(n-1)^5)%5^n; a(n)=min(b(n), 5^n-b(n))
(Python)
from sympy.ntheory import sqrt_mod
def A034939(n): return int(sqrt_mod(-1, 5**n)) # Chai Wah Wu, May 17 2022
CROSSREFS
KEYWORD
nonn,nice,easy
AUTHOR
EXTENSIONS
More terms from Michael Somos
STATUS
approved