login
A260031
Final nonzero digit of n^n in base 12.
1
1, 4, 3, 4, 5, 3, 7, 4, 9, 4, 11, 1, 1, 4, 3, 4, 5, 3, 7, 4, 9, 4, 11, 4, 1, 4, 3, 4, 5, 3, 7, 4, 9, 4, 11, 9, 1, 4, 3, 4, 5, 3, 7, 4, 9, 4, 11, 4, 1, 4, 3, 4, 5, 3, 7, 4, 9, 4, 11, 1, 1, 4, 3, 4, 5, 3, 7, 4, 9, 4, 11, 9, 1, 4, 3, 4, 5, 3, 7, 4, 9, 4, 11, 1
OFFSET
1,2
LINKS
José María Grau and Antonio M. Oller-Marcén, On the last digit and the last non-zero digit of n^n in base b, arXiv preprint arXiv:1203.4066 [math.NT], 2012.
PROG
(Python)
from gmpy2 import mpz, digits
def A260031(n):
s = digits(mpz(n)**mpz(n), 12)
t = s[-1]
while t == '0':
s = s[:-1]
t = s[-1]
return int(t, 12) # Chai Wah Wu, Jul 19 2015
(Haskell)
import Math.NumberTheory.Moduli (powerMod)
a260031 n = if x > 0 then x else f $ div (n ^ n) 12
where x = powerMod n n 12
f z = if m == 0 then f z' else m
where (z', m) = divMod z 12
-- Reinhard Zumkeller, Jul 19 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Jul 19 2015
EXTENSIONS
More terms from Chai Wah Wu, Jul 19 2015
STATUS
approved