Store all the values of phi ( x ) upto 10 ^ 5 with frequencies
HashMap < Integer , Integer > mp = new HashMap < Integer , Integer > ( ) ; for ( int i = 1 ; i < 100000 ; i ++ ) { if ( mp . containsKey ( phi ( i ) ) ) { mp . put ( phi ( i ) , mp . get ( phi ( i ) ) + 1 ) ; } else { mp . put ( phi ( i ) , 1 ) ; } } int i = 1 ; while ( count < n ) {