On an average ternary problem with prime powers