<input type="text" onkeypress="return (function(key,that){return (key>47&&key<58) && ((that.value.length%5==0)?that.value+=' ':1)})(event.keyCode,this)" />
demo:
<input type="text" onkeypress="return (function(key,that){return (key>47&&key<58) && ((that.value.length%5==0)?that.value+=' ':1)})(event.keyCode,this)" />
demo: