recursion for m=3, used for values of K > 100