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.

A289138 a(n) = smallest expomorphic number in base n: least integer k such that n^k ends in k, or 0 if no such k exists.

Original entry on oeis.org

1, 36, 7, 6, 5, 6, 3, 56, 9, 0, 1, 16, 7, 6, 5, 6, 3, 76, 9, 0, 1, 96, 7, 6, 5, 6, 3, 96, 9, 0, 1, 76, 7, 6, 5, 6, 3, 16, 9, 0, 1, 56, 7, 6, 5, 6, 3, 36, 9, 0, 1, 36, 7, 6, 5, 6, 3, 56, 9, 0, 1, 16, 7, 6, 5, 6, 3, 76, 9, 0, 1, 96, 7, 6, 5, 6, 3, 96, 9, 0, 1, 76, 7, 6, 5, 6, 3, 16, 9, 0, 1, 56, 7, 6, 5, 6, 3, 36, 9, 0
Offset: 1

Views

Author

Keywords

Comments

Definition: For positive integers b (the base) and n, the positive integer (allowing initial zeros) a(n) is expomorphic relative to base b if a(n) has exactly n decimal digits and if b^a(n) == a(n) (mod 10^n) or, equivalently, b^a(n) ends in a(n). [See Crux Mathematicorum link.]
The only twelve values a(n) can take are 0, 1, 3, 5, 6, 7, 9, 16, 36, 56, 76 and 96;
and the percentages of the time these occur are 10, 10, 10, 10, 20, 10, 10, 4, 4, 4, 4 and 4, respectively.
The bases, n, for which k is:
0: n == 0 (mod 10)
1: n == 1 (mod 10)
3: n == 7 (mod 10)
5: n == 5 (mod 10)
6: n == 4 or 6 (mod 10)
7: n == 3 (mod 10)
9: n == 9 (mod 10)
16: n == +/- 12 (mod 50)
36: n == +/- 2 (mod 50)
56: n == +/- 8 (mod 50)
76: n == +/- 18 (mod 50)
96: n == +/- 22 (mod 50).
Periodicity is 50.

Examples

			a(4) is 6 since 4^6 = 4096 which ends in 6.
		

Crossrefs

Cf. A288845.

Programs

  • Maple
    f:= proc(n) local k;
       if n mod 10 = 0 then return 0 fi;
       for k from 1 do if n^k - k mod 10^(1+ilog10(k)) = 0 then return k fi od
    end proc:
    map(f, [$1..100]); # Robert Israel, Jul 07 2017
  • Mathematica
    f[n_] := If[ Mod[n, 10] > 0, Block[{k = 1}, While[ PowerMod[n, k, 10^IntegerLength[k]] != k, k++]; k], 0]; Array[f, 88]
  • Python
    def a(n):
        if n%10==0: return 0
        k=1
        while pow(n, k, 10**len(str(k)))!=k: k+=1
        return k
    print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jun 29 2017