The change of base formula looks like this:
log x
(log to the base b of ) x = ----------- (you could also use ln instead of log)
log b
log 40 1.602
Then (log to the base 7 of) 40 = ------------ = ------------- = 1.896 (answer)
log 7 0.8451
check (on calculator): 7^1.896 = 40.023 (close enough to 40 to verify
that this method "worked")