%I #31 Aug 14 2021 16:03:27
%S 0,1,13,2,16,14,6,3,8,17,12,15,5,7,11,4,10,9
%N Discrete logarithm of n to the base 2 modulo 19.
%C Equivalently, a(n) is the multiplicative order of n with respect to base 2 (modulo 19), i.e., a(n) is the base-2 logarithm of the smallest k such that 2^k mod 19 = n. - _Jon E. Schoenfield_, Aug 13 2021
%D Carl Friedrich Gauss, "Disquisitiones Arithmeticae", Yale University Press, 1965; see p. 37.
%D I. M. Vinogradov, Elements of Number Theory, p. 221.
%H Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/DiscreteLogarithm.html">Discrete Logarithm</a>.
%F 2^a(n) == n (mod 19). - _Michael S. Branicky_, Aug 13 2021
%e From _Jon E. Schoenfield_, Aug 13 2021: (Start)
%e Sequence is a permutation of the 18 integers 0..17:
%e k 2^k 2^k mod 19
%e -- ------ ----------
%e 0 1 1 so a(1) = 0
%e 1 2 2 so a(2) = 1
%e 2 4 4 so a(4) = 2
%e 3 8 8 so a(8) = 3
%e 4 16 16 so a(16) = 4
%e 5 32 13 so a(13) = 5
%e 6 64 7 so a(7) = 6
%e 7 128 14 so a(14) = 7
%e 8 256 9 so a(9) = 8
%e 9 512 18 so a(18) = 9
%e 10 1024 17 so a(17) = 10
%e 11 2048 15 so a(15) = 11
%e 12 4096 11 so a(11) = 12
%e 13 8192 3 so a(3) = 13
%e 14 16384 6 so a(6) = 14
%e 15 32768 12 so a(12) = 15
%e 16 65536 5 so a(5) = 16
%e 17 131072 10 so a(10) = 17
%e 18 262144 1
%e but a(1) = 0, so the sequence is finite with 18 terms.
%e (End)
%p [ seq(mlog(n,2,19), n=1..18) ];
%t a[1]=0; a[n_]:=MultiplicativeOrder[2, 19, {n}]; Array[a, 18] (* _Vincenzo Librandi_, Mar 21 2020 *)
%o (PARI) a(n) = znlog(n, Mod(2, 19)); \\ _Kevin Ryde_, Aug 13 2021
%o (Python)
%o from sympy.ntheory import discrete_log
%o def a(n): return discrete_log(19, n, 2)
%o print([a(n) for n in range(1, 19)]) # _Michael S. Branicky_, Aug 13 2021
%Y Cf. A036120.
%K nonn,base,fini,full
%O 1,3
%A _N. J. A. Sloane_
%E Offset corrected by _Jon E. Schoenfield_, Aug 12 2021