Find a number containing N | Java implementation of the approach ; Function to compute number using our deduced formula ; Initialize num to n - 1 ; Driver code
import java . io . * ; class GFG { static int findNumber ( int n ) { int num = n - 1 ; num = 2 * ( int ) Math . pow ( 4 , num ) ; num = ( int ) Math . floor ( num / 3.0 ) ; return num ; } public static void main ( String [ ] args ) { int n = 5 ; System . out . println ( findNumber ( n ) ) ; } }