it's not a problem that can be solved with a simple formula. the best way of solving the problem is to work through it like this:
the numbers you are able to make are represented by the formula 5x+13y where x is the number of 5p stamps you use, y is the number of 13p stamps.
numbers ending in 0 (10, 20, 30, etc) can all be made easily when x is even and y is zero, so the answer doesn't end in zero
numbers ending in 1 can be made where y=2 (or 12, 22, etc) and x is odd. The lowest is 5*1+13*2 = 31, therefore the highest number that cannot be made this way is 21.
numbers ending in 2 can be made where y = 4 (or 14, 24, etc) and x is even. The lowest is 5*0+13*4 = 42, therefore the highest number that cannot be made this way is 32.
numbers ending in 3 can be made where y is 1 and x is even, the lowest is 5*0+13*1 = 13, therefore the highest that cannot be made is 3.
numbers ending in 4 can be made where y is 3 and x is odd, the lowest is 5*1+13*3 = 44, therefore the highest that cannot be made is 34.
numbers ending in 5 are made where y is 0 and x is odd. obviously every number ending in 5 can be made this way.
numbers ending in 6 are made where y is 2 and x is odd, the lowest is 2*13 + 5*0 = 26, therefore the highest that cannot be made this way is 16
numbers ending in 7 are made where y is 4 and x is odd, the lowest is 4*13 + 5*1 = 57, therefore the highest that cannot be made this way is 47.
numbers ending in 8 are made where y is 1 and x is odd, the lowest is 1*13 + 1*5 = 18, therefore the highest that cannot be made this way is 8.
numbers ending in 9 are made where y is 3 and x is even. the lowest is 13*3 + 5*0 = 39, therefore the highest that cannot be made is 29.
so you are left with the answer that the highest number that cannot be made is 47.