login
A396831
a(n) is the n-th digit after the decimal point in the decimal expansion of the natural logarithm of n.
0
0, 9, 8, 2, 3, 9, 1, 4, 7, 9, 9, 8, 5, 5, 0, 2, 8, 2, 0, 3, 0, 1, 5, 1, 6, 6, 0, 3, 6, 6, 3, 8, 5, 1, 6, 5, 9, 1, 2, 1, 1, 5, 1, 2, 9, 2, 2, 3, 7, 9, 4, 6, 0, 9, 1, 2, 2, 3, 3, 2, 6, 8, 7, 9, 3, 1, 2, 7, 7, 4, 0, 2, 9, 6, 3, 5, 0, 3, 2, 2, 7, 5, 3, 3, 2, 5, 2, 6, 5, 4, 0, 4, 9, 1, 1, 5, 5, 4, 8
OFFSET
1,2
COMMENTS
For n >= 2, log(n) is transcendental (by the Lindemann-Weierstrass theorem) and hence irrational, so its n-th decimal digit is well-defined; log(1) = 0 gives a(1) = 0.
FORMULA
a(n) = floor(10^n * (log(n) - floor(log(n)))) mod 10.
EXAMPLE
log(1) = 0.0000........., so a(1) = 0.
log(2) = 0.6931471805..., whose 2nd decimal digit is 9, so a(2) = 9.
log(5) = 1.6094379124..., whose decimal digits after the point are 6,0,9,4,3,..., so the 5th is 3 and a(5) = 3.
PROG
(Python)
from decimal import Decimal, getcontext
def a(n):
if n == 1: return 0
getcontext().prec = n + 50
return int(str(Decimal(n).ln()).split(".")[1][n-1])
print([a(n) for n in range(1, 100)])
CROSSREFS
Cf. A002162 (log 2), A002391 (log 3), A016627 (log 4), A016628 (log 5), A016629 (log 6), A016630 (log 7), A016631 (log 8), A016632 (log 9), A002392 (log 10).
Sequence in context: A021897 A378205 A225458 * A092172 A133619 A276499
KEYWORD
nonn,base,easy,new
AUTHOR
STATUS
approved