Function to count total factors from 1 to N
function CountTotalfactors ( ) { tfactor [ 1 ] = pre [ 1 ] = 1 ; for ( var i = 2 ; i <= MAX ; i ++ ) { var mspf = spf [ i ] ; var prim = mspf ; var temp = i ; var cnt = 0 ; while ( temp % mspf == 0 ) { temp = parseInt ( temp / mspf ) ; cnt += 1 ; prim = prim * mspf ; }