well perhaps 4000 rpm is on the rev limiter and the tacho or the rev limiter are wrong?
maybe its worth either checking the tacho calibration or trying a 19"?
also check you are getting full throttle and the ignition advance is working properly.
if the carbs are clean does squeezing the primer bulb make any difference? Ie fuel starvation.
I am sure NOS4r2 will have some more ideas?
did you check the cupping on the prop? its possible i think to replace a plain 17 with a cupped 15 and get the same apparent pitch? someone will correct me if i am wrong!!
if all else fails put the rude back on and i will take the yam off your hands