#!ruby -nrprime d=0,*[-1]*n=$_.to_i Prime.each(999){|p|n.downto(p){|i|t=d[i-p]+1;t>0&&d[i]