Basic way to calculate all prime factors
while ( temp > 1 ) { long x = lpf [ ( int ) temp ] ; if ( single_number . ContainsKey ( x ) ) { single_number [ x ] ++ ; } else { single_number [ x ] = 1 ; } temp /= x ; }