I have an old server that runs important PHP aplication that required PHP 5.2.17. What is the newest WordPress that I can install on it?
I think you're looking at this the wrong way.
Having an old application that requires such a archaic PHP version is bad enough. That does not mean, your new WordPress installation needs to use that same old version though. Instead, I would suggest to keep PHP 5.2.17 for the legacy application and use the latest PHP version for WordPress.
There are various ways to do this, it all depends on how exactly your server is set up.
Based on the PHP compatibility chart, WordPress version 5.1 is the last version to support PHP 5.2.