A Math problem using shell script

Have a bit complicated math query ..

Basically i am given a number which is > 50 ..
I am suppose to find the calculation to get a number which is equal or more than the input number and is also a multiple of any number between 20 - 30 .

 
For example .
Input number is 60 .
Now 20x3 =60   and  30x2=60   , so my ouput should be 20x3=60,30x2=60
 
2nd example 
Input number is 59
In this case the next number possible to 59 is 60 using the logic above ,so
my output would again be  20x3=60,30x2=60.
 
3rd example 
Input number is 113
In this case the next number which fits the criteria would be 116 .
29x4=116   , so my output should be 29x4=116

Again ... the key is that the number has to be a multiple of any number between 20 -30 and should be equal to or next highest number to the input number ....
I have to use the logic as part of a bigger script ...

Thanks

This should work fine in sh/ksh/bash:

my_query()
{
    VALUE=$1
    while true
    do
       DIV=20
       while [ $DIV -le 30 ]
       do
          let FACTOR=VALUE/DIV
          let RESULT=FACTOR*DIV
          [ $RESULT -eq $VALUE ] && answer=$answer","${DIV}x${FACTOR}=$VALUE
          let DIV=DIV+1
       done
       if [ -n "$answer" ]
       then
          # Remove leading comma
          echo $answer | sed 's/^,//'
          return
       fi
       let VALUE=VALUE+1
    done
}
printf "Number: "
read number
my_query $number

Edit: Oh, BTW for your last example 23x5=115

$ cat query
awk -v num=$1 'BEGIN{while (1) {for (i=20;i<=30;i++) if (num%i=="0") {printf "%d X %d = %d\n", i, num/i, num;exit} ; num++}}'

$ ./query 131
22 X 6 = 132

$ ./query 113
23 X 5 = 115