There is recursion: an+1= an-20 * (1-(4000-bn)/4000) bn+1= bn-20 * (1+(2000-an)/2000.
The general term of series with initial values A0 = 2000 and B0 = 4000 can be written in complex numbers, but it is not necessary, and it can be known by matlab calculation.
Yoshihiko can defeat the octopus. After 136 seconds, the octopus's health drops to 0, leaving Yoshihiko with 524 health points [rounded].