Function to return the smallest integer > n with digit m occurring exactly k times
function findInt ( $ n , $ m , $ k ) { $ i = $ n + 1 ; while ( true ) { if ( digitWell ( $ i , $ m , $ k ) ) return $ i ; $ i ++ ; } }