text: lookup [ i ] [ j ] is going to store GCD of arr [ i . . j ] . Ideally lookup table size should not be fixed and should be determined using n Log n . It is kept constant to keep code simple .
code: static int [ ] [ ] table = new int [ MAX ] [ MAX ] ;