> 
> Look at the following sequence:  
> 
> 3, 5, 6, 9, 10, 12, 17, 18, 20....
> 
> 
> All the numbers in the series has exactly 2 bits set in their binary representation. Your task is simple, you have to find the Nth number of this sequence.
> 
> 
> 1 <= T <= 105  
> 
> 1 <= N <= 1014
> 
> 
> 

```
public class Solution {

    public static void main(String[] args) {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
        Scanner sc = new Scanner (System.in);
        int t = sc.nextInt();
        while ( t > 0 ){
            int n = sc.nextInt();
            t--;
             int x =1;
            while ( n > 0 ){

               int y = 0;
                while ( y < x ){
                     n--;
                    if ( n == 0 ){
                        System.out.println((1<<x)|(1<<y));
                    }

                    y++;

                }

                x++;
            }
        }
    }
}

```

This is giving me a timeout error can i have an optimized solution of the given range of inputs