Driver code
let edges = [ [ 1 , 2 ] , [ 2 , 3 ] , [ 3 , 1 ] , [ 4 , 3 ] , [ 4 , 5 ] , [ 5 , 3 ] ] ; let size = edges . length ; n = 5 ; let prime = new Array ( n + 1 ) ; for ( let i = 0 ; i < prime . length ; i ++ ) prime [ i ] = true ; SieveOfEratosthenes ( prime , n ) ; for ( let i = 0 ; i < size ; i ++ ) { graph [ edges [ i ] [ 0 ] , edges [ i ] [ 1 ] ] = 1 ; graph [ edges [ i ] [ 1 ] , edges [ i ] [ 0 ] ] = 1 ; d [ edges [ i ] [ 0 ] ] ++ ; d [ edges [ i ] [ 1 ] ] ++ ; } ans = 0 ; primeCliques ( 0 , 1 , prime ) ; document . write ( ans ) ;