I haven't written any questions since I switched to linux. Start writing again today.
First, find the number of each prime factor in the class of a number, then we can calculate the number of prime factor for each number starting from 2 to this number, corresponding addition. For example, 10! = 1*2*3*4*5*6*7*8*9*10, the number of 2 is 2, 4, 6, 8, the sum of two factors in 10 is 1 + 2 + 1 + 3 + 1 = 8. And so on
The next step is to find the prime factor and number of each number. The template is enough. Not a difficult question
Second, pay attention to the output format. Here I made a mistake. I did not carefully consider that if the number of outputs is exactly a multiple of 15, then the last line should not be a line feed; when outputting a line feed, note that when k is a multiple of 15, only one line feed is output, because k does not change every cycle value, so if it is written outside of if, there will be a lot of line feed output, not available! Therefore, the processing of this output should be the first when there is a number to be output. If the remainder of 15 k is 1, it means a new line can be entered, then output this number to avoid the case where it is just a multiple of 15!
The core code is as follows:
int anss[101];int main(){prime_sieve();int n;while ( scanf("%d",&n) != EOF && n ) {for ( int i = 2; i <= 100; ++i ) if (!is_prime(i) ) anss[i] = -1; else anss[i] = 0; for ( int i = 2; i <= n; ++i ) {IIV ans;prime_factorize(i, ans);int len = ans.size();for ( int i = 0; i < len; ++i ) anss[ans[i].first]+=ans[i].second;}printf("%3d! =", n);for ( int i = 2, k = 0; i <= n; ++i ) {if ( anss[i] != -1 ) { k++; if ( k > 1 && k % 15 == 1 ) printf("\n "); printf("%3d", anss[i]);}}printf("\n");} return 0;}