Function to print the nodes with prime degree in the tree whose Prufer sequence is given
static void PrimeDegreeNodes ( int prufer [ ] , int n ) { int nodes = n + 2 ; boolean [ ] prime = new boolean [ nodes + 1 ] ; Arrays . fill ( prime , true ) ; SieveOfEratosthenes ( prime , nodes + 1 ) ;