I want to find a number $x$, which is divisor of number $n$ such that $x$ is less than or equal to a number $m$.
I just know one approach i.e. try all numbers from $m$ to $1$ and check as if it divides $n$ completely . Is there any better algorithm, if yes, then please share.
Well, prime factor $n = \prod p_i^{a_i}$ and just test the factors that are less or equal to $m$.
Example: find all factors of $360=2^3\times3^2\times5$ that are less than $27$.
$2^03^05^0=1; 2^13^05^0=2;2^23^05^0=4;2^33^05^0 = 8$;
$2^03^15^0=3;2^13^15^0=6;2^23^15^0=12;2^33^15^0 = 24$;
$2^03^25^0=9;2^13^25^0=18;*\text{stop}*;2^23^25^0=36;$;
$2^03^05^1=5; 2^13^05^1=10;2^23^05^1=20;*\text{stop}*;2^33^05^1=40$;
$2^03^15^1=15;*\text{stop}*;2^13^15^0=30;$;
$*\text{stop}*2^03^25^1=45;$
So $1,2,4,8,3,6,12,24,9,18,5,10,20,15$.
So you don't have to check all numbers. Just the ones that are factors.
===
As per your comment. Let's suppose we want to find factors of $2^{10}3^{10}5^{10} $ less than $6123$. We can try to guestimate the highest factor thusly:
The $5$ can be as high $5^5=3125$. There's "no room" for any factors of $2$ or $3$. We can replace $5$ with $2*3$, $2^2$ and maybe occasionally$2^3$ and $3^2$.
We can do $5^4=625$ and we can $5^4*3^2;5^4*2*3;5^4*2^3$
$5^3*3^3;5^3*3^2*2^2;5^3*3*2^4;5^3*2^4$
$5^2*3^5;5^2*3^4*2;5^2*3^3*2^3;5^2*3^2*2^4;5^2*3*2^6;5^2*2^7$
$5*3^6;5*3^5*2^4;5*3^4*2^3;5*3^3*2^5;5*3^2*2^7;5*3*2^8;5*2^10$
$3^7*2;3^6*2^3;3^5*2^4;3^4*2^6;3^3*2^8;3^2*2^9;3*2^{10} $
So we just count all the lower powers than those.
That was an extreme example. If I go back to my 360 and factors less than 27, we can do
$2^3*3$ (and all $2^a3^b ;a\le 3;b\le 1$)
$2^2*5$, $2*3^2$ $3*5$. And all lower powers.