cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A260031 Final nonzero digit of n^n in base 12.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Jul 19 2015

Keywords

Crossrefs

Programs

  • 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
  • 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
    

Extensions

More terms from Chai Wah Wu, Jul 19 2015