If aux / i is less than M - aux and is not included earlier .
if ( aux + parseInt ( aux / i , 10 ) <= M && ! visited [ aux + parseInt ( aux / i , 10 ) ] ) { Q . push ( [ aux + parseInt ( aux / i , 10 ) , cont + 1 ] ) ; visited [ aux + parseInt ( aux / i , 10 ) ] = true ; } } }