These are always tricky types of problems. Without really analyzing it, I would refer you to the Online Encyclopedia of Integer Sequences. Plugging in 1,2,4,15 results in several hits, including:

https://oeis.org/A181442

I do not claim that the formula there is the one for your problem, but it's certainly worth looking at.

## Like this thread? Share it with others