Write a method public static int lowestBasePalindrome int nu
Solution
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Surya
 */
 public class palindrome {
 
     static int buildnumber(int i,int n,int s[])//building number from base///
     {
       
         int k=0,m,rm;
         while(n>0)
         {
             m=n%i;
if(m==0)s[k++]=0;
             while(m>0)
             {
                     s[k++]=m%10;
                     m=m/10;
             }
               
              n=n/i;
         }
      
         return k;
     }
     static int reverse(int n)
     {
         int k=0;
         while(n>0)
         {
             k=k*10+n%10;
             n=n/10;
         }
         return k;
     }
     static boolean palindromecheck(int i,int n)//function that checks palindrome or not
     {
       
         int k,l,j,c=0;
         int s[]=new int[100000000];
         k = buildnumber(i,n,s);
         l=k-1;
         j=0;
         while(j<k)
         {
             if(s[j++]==reverse(s[l--]))c++;
             else break;
         }
       
       
         if(c==k)return true;
       
       
         return false;
     }
     public static int LowestBasePalindrome(int n)//fucntion that returns lowest base integer
     {
             int i;
             for(i=2;i<n;i++)
             {
                 if(palindromecheck(i,n)) {
                     return i;
                 }
             }
             return i;
     }
     public static void main(String argv[])
     {
         System.out.println(LowestBasePalindrome(917));
     }
   
 }
output:-
92
explanation:- for 917 on base 92 the number that generated is 989 which is palindrome
input:-100
output:--
3


