In how many ways the ball will come back to the first boy after N turns | Function to return the number of sequences that get back to Bob ; Driver code
import java . util . * ; class GFG { static int numSeq ( int n ) { return ( int ) ( ( Math . pow ( 3 , n ) + 3 * Math . pow ( - 1 , n ) ) / 4 ) ; } public static void main ( String [ ] args ) { int N = 10 ; System . out . printf ( " % d " , numSeq ( N ) ) ; } }