Answer:
4000 / 1590 = 2.52 half lives
500 mg * 1/2^2.52 = x where x is the amount left after 2.52 half-lives
(1/2)^2.52 = y where y is the needed fraction
2.52 ln 1/2 = ln y
2.52 * -.693 = -1.746 = ln y
y = .174
And 500 * .174 = 87 mg left after 2.52 half-lives
Check:
.5^2.52 = .174